mirror of
https://github.com/cheat/cheat.git
synced 2025-12-08 08:24:01 +01:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a07a1e96c | ||
|
|
aa9b3e8bb4 | ||
|
|
9db66dbaeb | ||
|
|
c906a394cc | ||
|
|
6ca560c1b7 | ||
|
|
e75e9bb211 | ||
|
|
dd93473464 | ||
|
|
0d6de64fc0 | ||
|
|
26991977fd | ||
|
|
878e266f5b | ||
|
|
55e7181d87 | ||
|
|
59accc64f7 | ||
|
|
c18e475fd1 | ||
|
|
2166a57ccd | ||
|
|
b2e1400bb6 | ||
|
|
30a49d3596 | ||
|
|
86ba1ad9e6 | ||
|
|
820de5dba8 | ||
|
|
33f0dc346b | ||
|
|
889c8ef8fe | ||
|
|
434802341e | ||
|
|
aba6fe5043 | ||
|
|
86d1ce58a9 | ||
|
|
fd7f31bf16 |
@@ -38,7 +38,7 @@ from docopt import docopt
|
||||
|
||||
if __name__ == '__main__':
|
||||
# parse the command-line options
|
||||
options = docopt(__doc__, version='cheat 2.1.8')
|
||||
options = docopt(__doc__, version='cheat 2.1.9')
|
||||
|
||||
# list directories
|
||||
if options['--directories']:
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
# sum integers from a file or stdin, one integer per line:
|
||||
printf '1\n2\n3\n' | awk '{ sum += $1} END {print sum}'
|
||||
|
||||
# using specific character as separator to sum integers from a file or stdin
|
||||
printf '1:2:3' | awk -F ":" '{print $1+$2+$3}'
|
||||
|
||||
# print a multiplication table
|
||||
seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}'
|
||||
|
||||
@@ -51,3 +51,9 @@ git show 83fb499:path/fo/file.ext # Shows the file as it a
|
||||
git diff branch_1 branch_2 # Check difference between branches
|
||||
git log # Show all the commits
|
||||
git status # Show the changes from last commit
|
||||
|
||||
# Commit history of a set of files
|
||||
git log --pretty=email --patch-with-stat --reverse --full-index -- Admin\*.py > Sripts.patch
|
||||
|
||||
# Import commits from another repo
|
||||
git --git-dir=../some_other_repo/.git format-patch -k -1 --stdout <commit SHA> | git am -3 -k
|
||||
|
||||
13
cheat/cheatsheets/jq
Normal file
13
cheat/cheatsheets/jq
Normal file
@@ -0,0 +1,13 @@
|
||||
# Pretty print the json
|
||||
jq "." < filename.json
|
||||
|
||||
# Access the value at key "foo"
|
||||
jq '.foo'
|
||||
|
||||
# Access first list item
|
||||
jq '.[0]'
|
||||
|
||||
# Slice & Dice
|
||||
jq '.[2:4]'
|
||||
jq '.[:3]'
|
||||
jq '.[-2:]'
|
||||
25
cheat/cheatsheets/jrnl
Normal file
25
cheat/cheatsheets/jrnl
Normal file
@@ -0,0 +1,25 @@
|
||||
# Add entry to default jrnl (from your configured text editor)
|
||||
jrnl
|
||||
|
||||
# Add entry to default jrnl
|
||||
jrnl Write entry here.
|
||||
|
||||
# List of tags
|
||||
jrnl --tags
|
||||
|
||||
# Entries per tag
|
||||
jrnl @tag
|
||||
|
||||
# Export jrnl as json
|
||||
jrnl --export json
|
||||
|
||||
# Entries in a timeframe
|
||||
jrnl -from 2009 -until may
|
||||
|
||||
# Add Sublime text to .jrnl_config
|
||||
|
||||
# Windows
|
||||
"editor": "F:\\Powerpack\\Sublime\\sublime_text.exe -w"
|
||||
|
||||
# Linux
|
||||
"editor": "/usr/bin/sublime -w"
|
||||
@@ -35,6 +35,9 @@ ___
|
||||
# links
|
||||
This is [an example](http://example.com "Title") inline link.
|
||||
|
||||
# image
|
||||

|
||||
|
||||
# emphasis
|
||||
*em* _em_
|
||||
|
||||
|
||||
3
cheat/cheatsheets/more
Normal file
3
cheat/cheatsheets/more
Normal file
@@ -0,0 +1,3 @@
|
||||
# To show the file start at line number 5
|
||||
more +5 file
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# To dump a database to a file (Note that your password will appear in your command history!):
|
||||
# To dump a database to a file (Note that your password will appear in your command history!):
|
||||
mysqldump -uusername -ppassword the-database > db.sql
|
||||
|
||||
# To dump a database to a file:
|
||||
mysqldump -uusername -p the-database > db.sql
|
||||
|
||||
# To dump a database to a .tgz file (Note that your password will appear in your command history!):
|
||||
# To dump a database to a .tgz file (Note that your password will appear in your command history!):
|
||||
mysqldump -uusername -ppassword the-database | gzip -9 > db.sql
|
||||
|
||||
# To dump a database to a .tgz file:
|
||||
mysqldump -uusername -p the-database | gzip -9 > db.sql
|
||||
|
||||
# To dump all databases to a file (Note that your password will appear in your command history!):
|
||||
# To dump all databases to a file (Note that your password will appear in your command history!):
|
||||
mysqldump -uusername -ppassword --all-databases > all-databases.sql
|
||||
|
||||
# To dump all databases to a file:
|
||||
|
||||
20
cheat/cheatsheets/nova
Normal file
20
cheat/cheatsheets/nova
Normal file
@@ -0,0 +1,20 @@
|
||||
# To list VMs on current tenant:
|
||||
nova list
|
||||
|
||||
# To list VMs of all tenants (admin user only):
|
||||
nova list --all-tenants
|
||||
|
||||
# To boot a VM on a specific host:
|
||||
nova boot --nic net-id=<net_id> \
|
||||
--image <image_id> \
|
||||
--flavor <flavor> \
|
||||
--availability-zone nova:<host_name> <vm_name>
|
||||
|
||||
# To stop a server
|
||||
nova stop <server>
|
||||
|
||||
# To start a server
|
||||
nova start <server>
|
||||
|
||||
# To attach a network interface to a specific VM:
|
||||
nova interface-attach --net-id <net_id> <server>
|
||||
21
cheat/cheatsheets/pip
Normal file
21
cheat/cheatsheets/pip
Normal file
@@ -0,0 +1,21 @@
|
||||
# Search for packages
|
||||
pip search SomePackage
|
||||
|
||||
# Install some packages
|
||||
pip install SomePackage
|
||||
|
||||
# Output and install packages in a requirement file
|
||||
pip freeze > requirements.txt
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Show details of a package
|
||||
pip show SomePackage
|
||||
|
||||
# List outdated packages
|
||||
pip list --outdated
|
||||
|
||||
# Upgrade all outdated packages, thanks to http://stackoverflow.com/a/3452888
|
||||
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
|
||||
|
||||
# Install specific version of a package
|
||||
pip install -I SomePackage1==1.1.0 'SomePackage2>=1.0.4'
|
||||
@@ -8,7 +8,12 @@ rpm -e <package>
|
||||
rpm -qf </path/to/file>
|
||||
|
||||
# To find what files are installed by a package:
|
||||
rpm -ql <package>
|
||||
rpm -qpl <rpm>
|
||||
|
||||
# To find what packages require a package or file:
|
||||
rpm -q --whatrequires <package>
|
||||
rpm -q --whatrequires <file>
|
||||
|
||||
# To list all installed packages:
|
||||
rpm -qa
|
||||
|
||||
8
cheat/cheatsheets/unzip
Normal file
8
cheat/cheatsheets/unzip
Normal file
@@ -0,0 +1,8 @@
|
||||
# Extract archive
|
||||
unzip archive.zip
|
||||
|
||||
# Test integrity of archive
|
||||
unzip -tq archive.zip
|
||||
|
||||
# List files and directories in a file
|
||||
unzip -l archive.zip
|
||||
16
cheat/cheatsheets/weechat
Normal file
16
cheat/cheatsheets/weechat
Normal file
@@ -0,0 +1,16 @@
|
||||
# Set unread marker on all windows
|
||||
Ctrl-s Ctrl-u
|
||||
|
||||
# Switch buffer left
|
||||
Ctrl-p, Alt-left
|
||||
# Switch buffer right
|
||||
Ctrl-n, Alt-right
|
||||
# Next buffer with activity
|
||||
Alt-a
|
||||
# Switch buffers
|
||||
Alt-0...9
|
||||
|
||||
# Scroll buffer title
|
||||
F9/F10
|
||||
# Scroll nick list
|
||||
F11/F12
|
||||
@@ -2,7 +2,7 @@
|
||||
wget http://path.to.the/file
|
||||
|
||||
# To download a file and change its name
|
||||
wget http://path.to.the/file -o newname
|
||||
wget http://path.to.the/file -O newname
|
||||
|
||||
# To download a file into a directory
|
||||
wget -P path/to/directory http://path.to.the/file
|
||||
|
||||
5
cheat/cheatsheets/zip
Normal file
5
cheat/cheatsheets/zip
Normal file
@@ -0,0 +1,5 @@
|
||||
# Create zip file
|
||||
zip archive.zip file1 directory/
|
||||
|
||||
# To list, test and extract zip archives, see unzip
|
||||
cheat unzip
|
||||
Reference in New Issue
Block a user