Skip to content

Instantly share code, notes, and snippets.

@MaximeD
Created August 12, 2017 15:58
Show Gist options
  • Save MaximeD/b97605f5fb86d8782c1bc99d12b1b5d2 to your computer and use it in GitHub Desktop.
Save MaximeD/b97605f5fb86d8782c1bc99d12b1b5d2 to your computer and use it in GitHub Desktop.
description
[[snippets]]
description = "Replace tab with spaces"
command = "find . -name $1 ! -type d -exec bash -c 'expand -i -t 2 \"$0\" > /tmp/e && mv /tmp/e \"$0\"' {} \\;"
[[snippets]]
description = "Empty log files"
command = "find . -iname \"*.log\" | xargs truncate --size 0"
[[snippets]]
description = "[YOUBOOX] copy database structure"
command = "cp ~/code/rails/youboox/youboox-web/db/schema.rb ~/code/rails/youboox/youboox-web/db/structure.sql db/"
[[snippets]]
description = "Most frequently used commands"
command = "history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] \" \" CMD[a]/count*100 \"% \" a;}' | grep -v \"./\" | column -c3 -s \" \" -t | sort -nr | nl | head -n10"
[[snippets]]
description = "Recognize keycodes"
command = "xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf \"%-3s %s\\n\", $5, $8 }'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment