Last active
February 26, 2019 15:00
-
-
Save fergusb/bc725054ff56837d71b8042a92d82324 to your computer and use it in GitHub Desktop.
description
This file contains 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 = "DDOS Monitoriing" | |
command = "sudo netstat -nap | grep \\:80\\ | awk '{print $5}' | tr \":\" \" \" | awk '{print $1}' | sort | uniq -c | sort -n" | |
output = "" | |
[[snippets]] | |
description = "find and replace in filename (e.g., hyphen for a space)" | |
command = "zmv '* - *' '$f:s/ - / '" | |
output = "" | |
[[snippets]] | |
description = "convert DOS newlines (CR/LF) to Unix format" | |
command = "sed 's/\\x0D$//'" | |
output = "" | |
[[snippets]] | |
description = "double space a file which already has blank lines in it" | |
command = "sed '/^$/d;G'" | |
output = "" | |
[[snippets]] | |
description = "count lines (emulates 'wc -l')" | |
command = "sed -n '$='" | |
output = "" | |
[[snippets]] | |
description = "delete leading whitespace (spaces, tabs) from front of each line" | |
command = "sed 's/^[ \\t]*//'" | |
output = "" | |
[[snippets]] | |
description = "delete trailing whitespace (spaces, tabs) from end of each line" | |
command = "sed 's/[ \\t]*$//'" | |
output = "" | |
[[snippets]] | |
description = "delete BOTH leading and trailing whitespace from each line" | |
command = "sed 's/^[ \\t]*//;s/[ \\t]*$//'" | |
output = "" | |
[[snippets]] | |
description = "print only lines of 79 characters or longer" | |
command = "sed -n '/^.\\{79\\}/p'" | |
output = "" | |
[[snippets]] | |
description = "print only lines of less than 79 characters" | |
command = "sed -n '/^.\\{79\\}/!p'" | |
output = "" | |
[[snippets]] | |
description = "delete duplicate, consecutive lines from a file (emulates 'uniq')" | |
command = "sed '$!N; /^\\(.*\\)\\n\\1$/!P; D'" | |
output = "" | |
[[snippets]] | |
description = "delete duplicate, nonconsecutive lines from a file" | |
command = "sed -n 'G; s/\\n/&&/; /^\\([ -~]*\\n\\).*\\n\\1/d; s/\\n//; h; P'" | |
output = "" | |
[[snippets]] | |
description = "delete all leading blank lines at top of file" | |
command = "sed '/./,$!d'" | |
output = "" | |
[[snippets]] | |
description = "list $PATH variables" | |
command = "echo $PATH | tr : \"\\n\"" | |
output = "" | |
[[snippets]] | |
description = "convert Mac utf8 to utf8 proper" | |
command = "convmv -r -f utf8 -t utf8 --nfc --notest ." | |
output = "" | |
[[snippets]] | |
description = "Delete files older than 2 weeks from current directory" | |
command = "find . -mtime +14 | xargs rm -rfv" | |
output = "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment