Skip to content

Instantly share code, notes, and snippets.

@knqyf263
Last active March 12, 2017 09:08
Show Gist options
  • Save knqyf263/89773e5762410af6f0e23d1b0ef343b6 to your computer and use it in GitHub Desktop.
Save knqyf263/89773e5762410af6f0e23d1b0ef343b6 to your computer and use it in GitHub Desktop.
description
[[snippets]]
description = "Create a .keep file in all empty directories"
command = "find . -type d -empty -print0 | xargs -0 -I % touch %/.keep"
[[snippets]]
description = "Display all listen port"
command = "lsof -Pan -i tcp -i udp"
[[snippets]]
description = "Process with the largest memory usage"
command = "ps aux | sort -nrk +4 | head -n 1"
[[snippets]]
description = "Top 10 IP address with the number of occurrences"
command = "tail -10000 access_log | cut -f 1 -d ' ' | sort | uniq -c | sort -nr | head -10"
[[snippets]]
description = "All file rename (01.txt -> 01.md)"
command = "ls | sed -e s/\\.txt// | awk '{print .txt .md}' | xargs -n 2 mv"
[[snippets]]
description = "Display prime numbers"
command = "seq 1 100 | perl -lne 'print if (1x$_) !~ /^1?$|^(11+?)\\1+$/'"
[[snippets]]
description = "Descending order of line length"
command = "awk '{print length($0), $0}' sample.txt | sort -nr | head"
[[snippets]]
description = "Check expiration date of SSL certficate"
command = "echo | openssl s_client -connect example.com:443 2> /dev/null | openssl x509 -dates -noout"
[[snippets]]
description = "Get my global IP address"
command = "curl ifconfig.co"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment