diff --git a/cheat b/cheat index 6a054e3..0af41db 100755 --- a/cheat +++ b/cheat @@ -41,7 +41,9 @@ def cheat_files(cheat_directories): for cheat_dir in reversed(cheat_directories): cheats.update(dict([(cheat, cheat_dir) for cheat in os.listdir(cheat_dir) - if not cheat.startswith('.') + if not cheat.endswith('md') + and not cheat.startswith('.') + and not cheat.startswith('LICENSE') and not cheat.startswith('__')])) return cheats @@ -82,6 +84,7 @@ def main(): # if it does not, say so else: print 'No cheatsheet found for %s.' % keyphrase + def pretty_print(filename): diff --git a/cheatsheets/history b/cheatsheets/history new file mode 100644 index 0000000..90cf809 --- /dev/null +++ b/cheatsheets/history @@ -0,0 +1,2 @@ +# To see most used top 10 commands: +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 \ No newline at end of file diff --git a/cheatsheets/lsof b/cheatsheets/lsof new file mode 100644 index 0000000..a7f45fa --- /dev/null +++ b/cheatsheets/lsof @@ -0,0 +1,3 @@ +# To find listening ports +lsof -Pnl +M -i4 + diff --git a/cheatsheets/mysql b/cheatsheets/mysql new file mode 100644 index 0000000..2fe112f --- /dev/null +++ b/cheatsheets/mysql @@ -0,0 +1,5 @@ +# To create a database in utf8 charset +CREATE DATABASE owa CHARACTER SET utf8 COLLATE utf8_general_ci; + +# To add a user and give rights on the given database +GRANT ALL PRIVILEGES ON database.* TO 'user'@'localhost'IDENTIFIED BY 'password' WITH GRANT OPTION; \ No newline at end of file