Skip to main content

Posts

Showing posts from December, 2023

fmpeg convert all files in foler

    for i in *.avi; do ffmpeg -i "$i" "${i%.*}.mp4"; done for i in *.gif; do ffmpeg -i "$i" "${i%.*}.mp4"; done repair ffmpeg ffmpeg -fflags +genpts -i input.mkv -c copy repaired.mkv     fflags ‘ discardcorrupt ’ Discard corrupted packets.       

conversion

 1 pound (lb)= 0.453 592 37 kg = 453.59237 gm = 16 avoirdupois ounches (oz)= 7,000 grains =12 Apothecaries ounches   1 oz =  28.349523125 g   troy/Apothecaries ounce = 31.1034768 g   yard =0.9144 m   grain = 64.79891 milligrams.     Tower pound =5,400 grains =0.350 kg   carat = 0.2 grams = 200mg   catty = 1+1⁄3 pound avoirdupois  604.78982 grams in Hong Kong 604.5 grams historically in Vietnam 604.79 grams in Malaysia  604.8 grams in Singapore 600 grams (Taiwan, Japan, Korea and Thailand) 500 grams   = mainland china , market catty  picul = 100 catty tael =1/16 catty stone = 120 catty gwan = 30 catty     1kg=1000gm 1gm = 1000mg (milli) 1mg= 1000mcg (micro) 1kg=2.2 lb (pound) 1l = 1000ml 1tsp(teaspoon)=5ml 1tbsp(tablespoon)=3tsp=15ml  1oz(ounch) = 30 ml        

tmpfs firefox with narsil user.js

cat ffv #!/bin/sh volatile=/dev/shm/firefox-$USER if [ ! -r $volatile ]; then     mkdir -m0700 $volatile fi ln -sfn  ~/src/user.js/desktop/user.js /dev/shm/firefox-$USER/user.js apulse ~/opt/firefox/firefox -profile /dev/shm/firefox-$USER git clone --depth=1   https://codeberg.org/Narsil/user.js.git  ~/src/

firefox user agent override

  about:config general. useragent. override select type string new value add Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.2210.91 https://www.whatismybrowser.com/guides/the-latest-user-agent/edge     disable sync about:config identity.fxaccounts.enabled restart   privacy.trackingprotection.enabled   privacy.firstparty.isolate   TZ=UTC firefox   general.platform.override   media.peerconnection.ice.default_address_only     media.peerconnection.enabled   network.http.sendRefererHeader 0 or 1  https://wiki.mozilla.org/Security/Referrer   network.http.referer.XOriginPolicy   network.captive-portal-service.enabled   toolkit.telemetry.enabled   geo.enabled   browser.safebrowsing.malware.enabled browser.safebrowsing.phishing.enabled browser.safebrowsing.downloads.enabled browser.safebrowsing.downloads.remote.enabled       webgl.disabled                       javascript.options.wasm javascript.options.wasm_baselinej

kernel update checker

 cat kernel-update  #!/bin/bash # Function to fetch the latest kernel version from kernel.org get_latest_kernel_version() {     curl -s "https://www.kernel.org/finger_banner" | grep -oP '(?<=The latest stable version of the Linux kernel is:\s{13})\d+\.\d+.\d+' } # Function to compare two version numbers compare_versions() {     local IFS=.     local ver1=($1)     local ver2=($2)     for ((i=0; i<${#ver1[@]} && i<${#ver2[@]}; i++)); do         if ((10#${ver1[i]} > 10#${ver2[i]})); then             echo 1  # Version 1 is greater             return         elif ((10#${ver1[i]} < 10#${ver2[i]})); then             echo -1  # Version 2 is greater             return         fi     done     # If one version has more segments, it is greater     if (( ${#ver1[@]} > ${#ver2[@]} )); then         echo 1  # Version 1 is greater     elif (( ${#ver1[@]} < ${#ver2[@]} )); then         echo -1  # Version 2 is greater     else         echo 0  # Versions are

update time with curl linux

sudo date -s "$(curl -sI --head http://google.com | grep ^Date: | sed 's/Date: //g')"   curl -I 'https://example.com' 2>/dev/null | grep -i '^date:' | sed 's/^[Dd]ate: //g'     curl -I http://example.com 2>&1 | grep Date: sudo date -s " $(curl -I http://example.com 2>&1 | grep Date: | cut -d' ' -f5-8) Z"         dateFromServer=$(curl -v --insecure --silent https://nist.time.gov/ 2>&1 | grep '< Date' | sed -e 's/< Date: //' ) formattedTime=$( date + "%d%m%Y%H%M%S" -d " $dateFromServer " ) echo "Current time (DDMMYYYYHHMMSS): $formattedTime "     for bash  cat </dev/tcp/time.nist.gov/13          

bash substring

  NAME= ${MYVAR%:*} # retain the part before the colon NAME= ${NAME##*/} # retain the part after the last slash   ${MYVAR#pattern} # delete shortest match of pattern from the beginning ${MYVAR##pattern} # delete longest match of pattern from the beginning ${MYVAR%pattern} # delete shortest match of pattern from the end ${MYVAR%%pattern} # delete longest match of pattern from the end           So # means match from the beginning (think of a comment line) and % means from the end. One instance means shortest and two instances means longest.   ${MYVAR:3} # Remove the first three chars (leaving 4..end) ${MYVAR::3} # Return the first three characters ${MYVAR:3:5} # The next five characters after removing the first 3 (chars 4-9)     ${MYVAR/search/replace}