Merge branch 'master' of https://github.com/ozdemircili/cheat into ozdemircili-master

* 'master' of https://github.com/ozdemircili/cheat:
  Added history cheatsheet
  Added history cheatsheet
  History
  Added histroy cheatsheet
  Took out listing of Readme and License file on cheatsheets
  Added mysql cheatsheet
  Added lsof cheatsheet
  Added 2 new cheatsheets
This commit is contained in:
Chris Lane 2013-08-26 19:12:54 -04:00
commit 37b9e84497
4 changed files with 14 additions and 1 deletions

5
cheat
View file

@ -41,7 +41,9 @@ def cheat_files(cheat_directories):
for cheat_dir in reversed(cheat_directories): for cheat_dir in reversed(cheat_directories):
cheats.update(dict([(cheat, cheat_dir) cheats.update(dict([(cheat, cheat_dir)
for cheat in os.listdir(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('__')])) and not cheat.startswith('__')]))
return cheats return cheats
@ -84,6 +86,7 @@ def main():
print 'No cheatsheet found for %s.' % keyphrase print 'No cheatsheet found for %s.' % keyphrase
def pretty_print(filename): def pretty_print(filename):
try: try:
if os.path.splitext(filename)[1]: if os.path.splitext(filename)[1]:

2
cheatsheets/history Normal file
View file

@ -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

3
cheatsheets/lsof Normal file
View file

@ -0,0 +1,3 @@
# To find listening ports
lsof -Pnl +M -i4

5
cheatsheets/mysql Normal file
View file

@ -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;