-
-
Save sente/5126f972fc55712ff6d302923fb5b206 to your computer and use it in GitHub Desktop.
description
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[snippets]] | |
description = "Grep all files in a folder" | |
command = "grep -rn \"texthere\" ." | |
output = "" | |
[[snippets]] | |
description = "Sync only certain files using filters and rsync" | |
command = "rsync -rv --include '*/' --include '*something*' --exclude '*' --prune-empty-dirs Source/ Target/" | |
output = "" | |
[[snippets]] | |
description = "Search and replace in a bunch of files using sed" | |
command = "sed -i -e 's/SEARCHFOR/REPLACEMENT/g' *" | |
output = "" | |
[[snippets]] | |
description = "Search and replace in a bunch of files using sed, and create backups" | |
command = "sed -i.bak -e 's/SEARCHFOR/REPLACEMENT/g' *" | |
output = "" | |
[[snippets]] | |
description = "Search and replace strings in files, except certain folders" | |
command = "find . -type f ! -path \"./.git/*\" -exec sed -i 's/name1/name2/g' {} \\;" | |
output = "" | |
[[snippets]] | |
description = "List all files in a directory, fastest solution" | |
command = "tree -Ufain --noreport -o files.index" | |
output = "" | |
[[snippets]] | |
description = "Download a list of URLs into an organized folder, with cookies" | |
command = "wget -x --load-cookies=cookies.txt --no-clobber -i LIST_OF_URLS" | |
output = "" | |
[[snippets]] | |
description = "DOwnload youtube video as mp3" | |
command = "youtube-dl -x --audio-quality 2 --audio-format mp3 YOUTUBEURL" | |
output = "" | |
[[snippets]] | |
description = "Open a GUI program via SSH or CRON" | |
command = "export DISPLAY=:0 && /open/some/program" | |
output = "" | |
[[snippets]] | |
description = "CRON command to backup a file every 10 minutes" | |
command = "*/10 * * * * /bin/cp /some/file /some/other/file.backup$(date +%Y%m%d)" | |
output = "" | |
[[snippets]] | |
description = "Create a list of lines that are in the new file but not in the old file" | |
command = "grep -F -x -v -f list.old list.new > list.diff" | |
output = "" | |
[[snippets]] | |
description = "Run command over SSH" | |
command = "ssh user@server 'command'" | |
output = "" | |
[[snippets]] | |
description = "Sort datafile by first column in numerical order" | |
command = "sort -s -n -k 1,1 data.dat" | |
output = "" | |
[[snippets]] | |
description = "Word count of files of a particular type" | |
command = "find ./ -type f -name \"*work*\" -exec wc -w {} +" | |
output = "" | |
[[snippets]] | |
description = "Get only the changed lines between diffing two files" | |
command = "diff --new-line-format=\"\" --unchanged-line-format=\"\" urlsfull.txt urls1subset.txt > urlsfull-subset.txt" | |
output = "" | |
[[snippets]] | |
description = "Mirror a website" | |
command = "wget -r -np -N --convert-links --adjust-extension --header=\"Accept: text/html\" --user-agent=\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:21.0) Gecko/20100101 Firefox/21.0\" website.com" | |
output = "" | |
[[snippets]] | |
description = "Hack swiping apps (requires Android Debug Bridge)" | |
command = "while true; do adb shell input tap 1000 2200; sleep .$[ ( $RANDOM % 10 ) + 1 ]s; done" | |
output = "" | |
[[snippets]] | |
description = "Resize images on ImagicMagick" | |
command = "convert -size 100x100 input.png -resize 100x100 +profile \"*\" output.jpg" | |
output = "" | |
[[snippets]] | |
description = "sudo su && cd / && tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --one-file-system /" | |
command = "Backup an entire filesystem" | |
output = "" | |
[[snippets]] | |
description = "sudo tar -xvpzf /path/to/backup.tar.gz -C /media/whatever --numeric-owner" | |
command = "Restore an entire filesystem" | |
output = "" | |
[[snippets]] | |
description = "Run a command in terminal every 10 seconds" | |
command = "while true; do; COMMAND; sleep 10; done" | |
output = "" | |
[[snippets]] | |
description = "Monitor progresss of inserting SQL statements into database" | |
command = "pv database_sql_statements.sql | sqlite3 database.db" | |
output = "" | |
[[snippets]] | |
description = "Delete the first column of a data" | |
command = "awk '!($1=\"\")' filename" | |
output = "" | |
[[snippets]] | |
description = "Pipe data into xmgrace" | |
command = "cat datafile | xmgrace -" | |
output = "" | |
[[snippets]] | |
description = "tar a big directory and show the progress http://bit.ly/2nBKQBK" | |
command = "SIZE=`du -sk www.goodreads.com | cut -f 1` && tar cf - www.goodreads.com | pv -atep -s ${SIZE}k > /media/zns/Media/www.goodreads.com.tar" | |
output = "" | |
[[snippets]] | |
description = "Remove .lzma extension from each file in a directory" | |
command = "for i in *.lzma; do; mv -- \"$i\" \"${i%.lzma}\"; done" | |
output = "" | |
[[snippets]] | |
description = "tar a file, with progress, onto a remote server" | |
command = "SIZE=`du -sk www.goodreads.com | cut -f 1` && tar cf - www.goodreads.com | pv -atep -s ${SIZE}k | ssh [email protected] \"cat > www.goodreads.com.tar\"" | |
output = "" | |
[[snippets]] | |
description = "untar a file and get progress bar, with decompression http://archive.is/lbVOo" | |
command = "pv -atep file.tgz | tar xzf - -C target_directory" | |
output = "" | |
[[snippets]] | |
description = "Measure read and write speed of a drive" | |
command = "dd if=/dev/zero of=/test/drive/output conv=fdatasync bs=384k count=1k; rm -f /test/drive/output" | |
output = "" | |
[[snippets]] | |
description = "Convert a bunch of images named final.untitled.00001.jpg to movie" | |
command = "ffmpeg -framerate 25 -i final.untitled.%05d.jpg output.mp4" | |
output = "" | |
[[snippets]] | |
description = "Reveal free space in bytes" | |
command = "df -k *" | |
output = "" | |
[[snippets]] | |
description = "split a file onto multiple USB sticks simultaneously https://z.cowyo.com/split-filter/view" | |
command = "cat www.goodreads.com.dell.tar | pv -atep -s ${SIZE}k | split -b 45966182400 -d - part --filter=./split-filter" | |
output = "" | |
[[snippets]] | |
description = "Find intersection between two lists of items" | |
command = "comm -12 <(cat 1.txt | sort) <(cat 2.txt | sort) > intersection.txt" | |
output = "" | |
[[snippets]] | |
description = "Get number of FILES in a directory using" | |
command = "tree --dirsfirst -UF . | tail -n1" | |
output = "" | |
[[snippets]] | |
description = "Remove all the docker images" | |
command = "docker rmi -f $(docker images -q)" | |
output = "" | |
[[snippets]] | |
description = "Count number of sentences in a file" | |
command = "tr -d -C . <data/news3.txt | wc -c" | |
output = "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment