crashhacker

few bash scripts

Sep 22nd, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.94 KB | None | 0 0
  1. #makes images transparent by removing the white spaces in it
  2. #method 1
  3. gm convert source.png -transparent white result.png
  4. #method 2
  5. #d6daf0 - yotsuba color theme
  6. convert 1.gif -coalesce -alpha set -channel RGBA -fill '#d6daf0' -opaque none out.gif
  7. ffmpeg -i out.gif -c:v libvpx -crf 4 -b:v 0 -auto-alt-ref 0 -pix_fmt yuva420p -vf colorkey=#d6daf0 out.webm
  8.  
  9. #method 3
  10. convert -size 1280x720 xc:transparent -background transparent \
  11.     -channel RGBA -fill '#0FF8' \
  12.     -draw 'polygon 200, 600, 200, 20, 600, 50, 600, 50' -fill '#0008' \
  13.     -draw 'polygon 200, 660, 200, 40, 660, 70, 660, 70' -fill '#fFF8' \
  14.     -draw 'polygon 200, 500, 200, 00, 500, 30, 500, 30' -channel RGBA \
  15.     -depth 8 -blur '10x5' test.png
  16.  
  17. convert -size 1280x720 xc:yellow -background yellow -channel RGBA gnd.png
  18. ffmpeg -loop 1 -i test.png -t 1 -pix_fmt argb -vcodec qtrle z.mov
  19. ffmpeg -loop 1 -i gnd.png -t 1 -pix_fmt argb -vcodec qtrle gnd.mov
  20. ffmpeg -vcodec qtrle -i gnd.mov -vcodec qtrle -i z.mov \
  21.     -filter_complex "[0:0][1:0]overlay=format=rgb[out]" -shortest \
  22.     -map [out] -vcodec qtrle test.mov
  23.  
  24. #method 3
  25. for f in *.{mp4,mkv,gif,png,jpg};
  26. do ffmpeg -i "$f" -an -c:v libvpx -auto-alt-ref 0 -pix_fmt yuva420p "out/${f%.*}.webm"; done
  27.  
  28.  
  29. #search keywords in pdfs
  30. KEYWORD="$1"
  31. pdfgrep -R "$KEYWORD" ./
  32.  
  33. #get top processes based on their cpu usage (way lighter than htop)
  34. ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 20
  35.  
  36. #download images/ppts, pdfs etc from 4chan/8chan threads
  37. #!/bin/bash
  38. exts=(webm mp4 ppt pptx docx zip tar.gz gif png jpg pdf mp3 sh)
  39. tmpfile=".urls.tmp"
  40. lynx -dump -listonly -nonumbers $1 | sort -u > "$tmpfile"
  41. for ext in ${exts[*]}; do grep "\.$ext$" "$tmpfile" | tee -a $ext\_links.txt | aria2c -i - -d "$ext"; done
  42. rm "$tmpfile"
  43.  
  44. #clear cache in system (needs sudo obv)
  45. echo 1 > /proc/sys/vm/drop_caches
  46. echo 2 > /proc/sys/vm/drop_caches
  47. echo 3 > /proc/sys/vm/drop_caches
  48. sync
  49. sudo sync & sysctl -w vm.drop_caches=3
Add Comment
Please, Sign In to add comment