Still hacking in cheat sheets. Wrote a trivial python installer.

This commit is contained in:
Chris Lane 2013-08-10 16:32:49 -04:00
parent 1786a57d5e
commit 8e9cfc0eb1
2 changed files with 43 additions and 11 deletions

44
cheat
View File

@ -10,7 +10,6 @@ cheatsheets = {
# @todo: # @todo:
# - adb # - adb
# - at # - at
# - cut / split?
# - dd # - dd
# - df # - df
# - du # - du
@ -23,7 +22,6 @@ cheatsheets = {
# - mongoimport # - mongoimport
# - nc # - nc
# - rsync # - rsync
# - sed
# - shred # - shred
# - useradd / adduser # - useradd / adduser
# - xargs # - xargs
@ -134,6 +132,30 @@ notify-send -i 'icon-file/name' -a 'application_name' 'summary' 'body of message
The -i and -a flags can be omitted if unneeded. The -i and -a flags can be omitted if unneeded.
''', ''',
########## sed ################################################################
'sed' : '''
To replace all occurrences of "day" with "night" and write to stdout:
sed s/day/night file.txt
To replace all occurrences of "day" with "night" within file.txt:
sed s/day/night file.txt > file.txt
To replace all occurrences of "day" with "night" on stdin:
echo 'It is daytime' | sed s/day/night/
''',
########## split #############################################################
'split' : '''
To split a large text file into smaller files of 1000 lines each:
split file.txt -l 1000
To split a large binary file into smaller files of 10M each:
split file.txt -b 10M
To consolidate split files into a single file:
cat x* > file.txt
''',
########## sockstat ########################################################## ########## sockstat ##########################################################
'sockstat' : ''' 'sockstat' : '''
To view which users/processes are listening to which ports: To view which users/processes are listening to which ports:
@ -155,15 +177,6 @@ For more information, see:
http://unix.stackexchange.com/q/12755/44856 http://unix.stackexchange.com/q/12755/44856
''', ''',
########## redirection ########################################################
'stdout' : '''
To redirect stderr to stdout:
some-command 2>&1
To redirect stderr to a file
some-command 2> errors.txt
''',
########## ssh-copy-id ######################################################## ########## ssh-copy-id ########################################################
'ssh-copy-id' : ''' 'ssh-copy-id' : '''
To copy a key to a remote host: To copy a key to a remote host:
@ -188,6 +201,15 @@ To copy a key to a remote host on a non-standard port:
ssh-copy-id username@host -p 2222 ssh-copy-id username@host -p 2222
''', ''',
########## stdout #############################################################
'stdout' : '''
To redirect stderr to stdout:
some-command 2>&1
To redirect stderr to a file
some-command 2> errors.txt
''',
########## tar ############################################################### ########## tar ###############################################################
'tar' : ''' 'tar' : '''
To extract an uncompressed archive: To extract an uncompressed archive:

10
install Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env python
import shutil
import sys
try:
shutil.copy('./cheat', '/usr/local/bin/')
# shutil.move('./.cheat', '~')
except IOError as e:
print >> sys.stderr, "This installer must be run as root."
sys.exit(1)