├── .gitattributes ├── newsboat ├── coala ├── boxes ├── feh ├── typescript ├── curl ├── .tools ├── cheat-select-copy.sh ├── cheat-select.sh └── cheat.py ├── terminator ├── python-distribution ├── tlmgr ├── ansible ├── cocoapods ├── unix-archive ├── regex-recipies ├── vim-goyo ├── bash-tilde-expansion ├── gitlab-api ├── find ├── gradle ├── python-pipenv ├── bash-shortcuts ├── vim-spelling ├── pycharm ├── .hooks └── generate-mo.sh ├── clion ├── swift-cli ├── bpkg ├── python-virtualenvwrapper ├── .pre-commit-config.yaml ├── gpg ├── openapi-generator ├── bash-if ├── .github ├── README.md.mo ├── README.md └── LICENSE.md ├── gitlab-srv ├── linux ├── sysadmin ├── vim ├── jq ├── adb ├── apt ├── taskwarrior ├── git.yaml ├── vagrant ├── bash ├── markdown ├── git ├── pre-commit ├── bash-test └── android-studio /.gitattributes: -------------------------------------------------------------------------------- 1 | vagrant linguist-detectable=true linguist-language=Markdown 2 | -------------------------------------------------------------------------------- /newsboat: -------------------------------------------------------------------------------- 1 | #newsboat 2 | 3 | # Feed format 4 | [ ...] 5 | -------------------------------------------------------------------------------- /coala: -------------------------------------------------------------------------------- 1 | # coala 2 | 3 | ## Installation 4 | 5 | `pip3 install coala coala-bears` 6 | -------------------------------------------------------------------------------- /boxes: -------------------------------------------------------------------------------- 1 | # boxes 2 | 3 | # list all available box designs in the config file 4 | boxes -l 5 | -------------------------------------------------------------------------------- /feh: -------------------------------------------------------------------------------- 1 | 2 | # Rotate the image 90 degrees (counter)clockwise 3 | <, > 4 | -------------------------------------------------------------------------------- /typescript: -------------------------------------------------------------------------------- 1 | # Typescript 2 | 3 | # Getting started 4 | ``` 5 | npm init 6 | npm install --save-dev typescript 7 | ``` 8 | -------------------------------------------------------------------------------- /curl: -------------------------------------------------------------------------------- 1 | # curl 2 | 3 | - Send urlencoded data `curl --data-urlencode "name=John Doe" http://example.com` 4 | 5 | ## References 6 | 7 | https://ec.haxx.se/ 8 | -------------------------------------------------------------------------------- /.tools/cheat-select-copy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cheatsheet=$1 4 | 5 | cat $cheatsheet | sed -n "s/\\$//pg" | pick | xclip -selection clipboard -in 6 | -------------------------------------------------------------------------------- /terminator: -------------------------------------------------------------------------------- 1 | 2 | # Horizontal split 3 | Ctrl + Shift + E 4 | 5 | # Vertical split 6 | Ctrl + Shift + O 7 | 8 | # Close terminal 9 | Ctrl + Shift + W 10 | -------------------------------------------------------------------------------- /python-distribution: -------------------------------------------------------------------------------- 1 | 2 | # Generate distribution archives 3 | python setup.py sdist bdist_wheel 4 | 5 | # Upload the distribution archives 6 | twine upload dist/* 7 | 8 | -------------------------------------------------------------------------------- /tlmgr: -------------------------------------------------------------------------------- 1 | # tlmgr 2 | 3 | Install a package 4 | ``` 5 | tlmgr install 6 | ``` 7 | 8 | Search for a file in all packages 9 | ``` 10 | tlmgr search --global --file 11 | ``` 12 | -------------------------------------------------------------------------------- /ansible: -------------------------------------------------------------------------------- 1 | # ansible 2 | 3 | Execute a command on a host 4 | ```bash 5 | ansible -m command -a "command to execute" 6 | ``` 7 | 8 | View module documentation 9 | ```bash 10 | ansible-doc 11 | ``` 12 | -------------------------------------------------------------------------------- /cocoapods: -------------------------------------------------------------------------------- 1 | 2 | # CocoaPods 3 | 4 | Clear CocoaPods cache, re-download and re-install all pods 5 | ``` 6 | rm -rf "${HOME}/Library/Caches/CocoaPods" 7 | rm -rf "`pwd`/Pods/" 8 | pod update 9 | ``` 10 | -------------------------------------------------------------------------------- /unix-archive: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Archiving Commands 4 | 5 | ## List Content 6 | 7 | List the content of the archive 8 | ``` 9 | unzip -vl 10 | ``` 11 | 12 | ``` 13 | zipinfo -m 14 | ``` 15 | 16 | ``` 17 | gunzip -vl 18 | ``` 19 | -------------------------------------------------------------------------------- /regex-recipies: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Match a markdown code block. 4 | ```regex 5 | ^(([ \t]*`{3,4})([^\n]*)([\s\S]+?)(^[ \t]*\2)) 6 | ``` 7 | 8 | # Match the include directive of the C/C++ pre-processor 9 | ```regex 10 | ^\s*\#include\s+(["<][^">]+[">]) 11 | ``` 12 | -------------------------------------------------------------------------------- /vim-goyo: -------------------------------------------------------------------------------- 1 | # vim goyo 2 | 3 | # toggle Goyo with the specified dimension 4 | `:Goyo [dimension]` 5 | 6 | # the dimension follows this format 7 | `[(+|-)][x[(+|-)]]` 8 | 9 | # turn Goyo off 10 | `:Goyo!` 11 | 12 | # configuration 13 | `g:goyo_width` 14 | `g:goyo_height` 15 | `g:goyo_linenr` 16 | -------------------------------------------------------------------------------- /bash-tilde-expansion: -------------------------------------------------------------------------------- 1 | 2 | # Expands to home directory 3 | ~ 4 | 5 | # Append home directory with the patch specified 6 | ~/"path/to/another" 7 | 8 | # Expand to the username's home directory 9 | ~username 10 | 11 | # Expand to current directory 12 | ~+ 13 | 14 | # Expand to previous working directory 15 | ~- 16 | -------------------------------------------------------------------------------- /.tools/cheat-select.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cheatsheet=$1 4 | 5 | command=$(cat $cheatsheet | sed -n "s/\\$//pg" | pick) 6 | 7 | c=""" 8 | from fcntl import ioctl 9 | from sys import stdin, argv 10 | from termios import TIOCSTI 11 | 12 | [ioctl(stdin, TIOCSTI, c) for c in argv[1]] 13 | """ 14 | 15 | python -c "$c" "$command" 1> /dev/null 2>&1 16 | -------------------------------------------------------------------------------- /gitlab-api: -------------------------------------------------------------------------------- 1 | # gitlab api 2 | 3 | # pull all projects visible to a user 4 | TOKEN="PASTE_YOUR_PRIVATE_TOKEN_HERE"; 5 | JSON_KEY="ssh_url_to_repo"; 6 | curl --header "PRIVATE-TOKEN: $TOKEN" http://gitlab.com/api/v3/projects/visible?per_page=100 | grep -o "\"$JSON_KEY\":[^ ,]\+" | awk -F ':' '{printf "ssh://"; for (i=2; i" \; -print 5 | 6 | # exclude hidden files and directories from the results 7 | find . -not -path '*/\.*' 8 | 9 | # exclude hidden files and prune the search through hidden directories 10 | find . -type d -path '*/\.*' -prune -o -not -name '.*' -type f -print 11 | -------------------------------------------------------------------------------- /gradle: -------------------------------------------------------------------------------- 1 | # gradle 2 | 3 | List available tasks of a project 4 | ``` 5 | gradle -q tasks [--all] 6 | ``` 7 | 8 | Dependency insights of an Android project 9 | ``` 10 | gradlew :app:dependencyInsight --configuration [debug|release]CompileClasspath --dependency 11 | # For a project with product flavours 12 | gradlew :app:dependencyInsight --configuration flavour[Debug|Release]CompileClasspath --dependency 13 | ``` 14 | -------------------------------------------------------------------------------- /python-pipenv: -------------------------------------------------------------------------------- 1 | 2 | # Create a new virtual environment using python 3 3 | pipenv --python 3 4 | 5 | # Install a new package for the virtual environment (infereed from current directory) 6 | pipenv install 7 | 8 | # Generate requirements.txt 9 | pipenv lock --requirements > requirements.txt 10 | 11 | # Generate developing requirements.txt 12 | pipenv lock --requirements --dev > requirements-dev.txt 13 | 14 | -------------------------------------------------------------------------------- /bash-shortcuts: -------------------------------------------------------------------------------- 1 | 2 | # Cuts text from the cursor until the end of the line 3 | Control + K 4 | 5 | # Paste text 6 | Control + Y 7 | 8 | # Paste into the terminal 9 | Shift + Insert 10 | 11 | # Move to the end of the line 12 | Control + E 13 | 14 | # Move to the begin of the line 15 | Control + A 16 | 17 | # Move to the next space 18 | Alt + F 19 | 20 | # Move to the previous space 21 | Alt + B 22 | 23 | # Delete previous word 24 | Alt + Backspace 25 | -------------------------------------------------------------------------------- /vim-spelling: -------------------------------------------------------------------------------- 1 | # vim spelling 2 | 3 | # enable spellchecking 4 | `set spell!` 5 | 6 | # navigate spelling errors 7 | `]s` next error or warning 8 | `[s` prev error or warning 9 | `]S` next error (skip warning) 10 | `[S` prev error (skip warning) 11 | 12 | # ask for a suggestion 13 | `z=` 14 | 15 | # add and remove a word from the dictionary 16 | `zg` and `zug` 17 | 18 | # mark and remove a word as misspelled 19 | `zw` and `zuw` 20 | 21 | # change spellchecking language 22 | `set spelllang=es` 23 | -------------------------------------------------------------------------------- /pycharm: -------------------------------------------------------------------------------- 1 | 2 | # TODO https://www.jetbrains.com/help/pycharm/mastering-keyboard-shortcuts.html 3 | # Open the documentation tool window 4 | Ctrl + Q 5 | 6 | # Show intention actions 7 | Alt + Enter 8 | - This can be used to add documentation to an existing function or method; 9 | 10 | # Open suggestion window 11 | Ctrl + Space 12 | 13 | # Find action - search for commands and settings 14 | Ctrl + Shift + A 15 | 16 | # Code inspection - check for errors and warnings 17 | Alt + Shift + I 18 | -------------------------------------------------------------------------------- /.hooks/generate-mo.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | gitroot=$(git rev-parse --show-toplevel) 4 | 5 | DISCLAIMER="" 6 | export DISCLAIMER 7 | 8 | CHEAT_LISTING=$(cd "$gitroot" && find . -not -path "*/\.*" -maxdepth 1 -type f -exec basename {} \; | sort | awk 'NF{print "[" $0 "]" "(" $0 ");"}') 9 | export CHEAT_LISTING 10 | 11 | while (( "$#" )); do 12 | filename=$1 13 | output_filename=${filename%.mo} 14 | mo "$filename" > "$output_filename" 15 | shift 16 | done 17 | -------------------------------------------------------------------------------- /clion: -------------------------------------------------------------------------------- 1 | 2 | # Multiline editing 3 | 4 | ## Multiple editing cursor with mouse 5 | Ctrl + Alt + Shift + Right Click 6 | 7 | 8 | ## Multiple editing cursor spanning multiple lines 9 | Ctrl + Ctrl (Hold) + Up|Down 10 | 11 | ## Select next word occurancy 12 | (Windows/Linux) Alt + J 13 | (MacOSX) Alt + G 14 | ## Remove last occurency 15 | (Windows/Linux) Alt + Shift + J 16 | (MacOSX) Alt + Shift + G 17 | ## Select all occurancies 18 | (Windows/Linux) Alt + Ctrl + Shift + J 19 | (MaxOSX) Command + Alt + G 20 | -------------------------------------------------------------------------------- /swift-cli: -------------------------------------------------------------------------------- 1 | 2 | # swift cli 3 | 4 | ## swift-package 5 | 6 | Update the dependencies according to the restrictions inside `Package.swift` and update accordingly the 7 | file `Package.resolved`. 8 | ``` 9 | swift package update 10 | ``` 11 | 12 | Resolve the dependencies declared inside `Package.resolved` when the file already exists or by taking into 13 | account the restrictions inside `Package.swift`. In the last case the file `Package.resolved` will be 14 | created. 15 | ``` 16 | swift package resolve 17 | ``` 18 | -------------------------------------------------------------------------------- /bpkg: -------------------------------------------------------------------------------- 1 | # bpkg 2 | > Lightweight bash package manager 3 | 4 | # Up and running 5 | ```bash 6 | curl -Lo- "https://raw.githubusercontent.com/bpkg/bpkg/master/setup.sh" | bash 7 | ``` 8 | 9 | # Local or global installation of packges 10 | ```bash 11 | bpkg install term # locally installed from github.com/bpkg/term into ~/deps 12 | bpkg install -g term # globally installed from github.com/bpkg/term into /usr/local/bin 13 | ``` 14 | 15 | # Specify a version 16 | ```bash 17 | bpkg install jwerle/suggest.sh@0.0.1 -g # globally install from github.com/jwerle/suggest.sh 18 | ``` 19 | -------------------------------------------------------------------------------- /python-virtualenvwrapper: -------------------------------------------------------------------------------- 1 | # virtualenvwrapper 2 | 3 | > A tool to work with virtual environments. 4 | 5 | ## Work on a virtual environment. 6 | ```bash 7 | workon 8 | ``` 9 | 10 | ## Stop working on a virtual environment. 11 | ```bash 12 | deactivate 13 | ``` 14 | 15 | ## List all virtual environments. 16 | ```bash 17 | # -l long mode 18 | # -b brief mode 19 | lsvirtualenv [-l|-b] 20 | ``` 21 | 22 | ## Destroy a virtual environment. 23 | ```bash 24 | rmvirtualenv 25 | ``` 26 | 27 | ## Copy a virtual environment. 28 | ```bash 29 | cpvirtualenv 30 | ``` 31 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # See https://pre-commit.com for more information 2 | # See https://pre-commit.com/hooks.html for more hooks 3 | repos: 4 | - repo: https://github.com/pre-commit/pre-commit-hooks 5 | rev: v1.2.1-1 6 | hooks: 7 | - id: trailing-whitespace 8 | - id: end-of-file-fixer 9 | 10 | - repo: local 11 | hooks: 12 | - id: readme-generation 13 | name: Generate README.md 14 | description: This hook generate the README file for this repository. 15 | language: script 16 | files: '.*\.mo' 17 | entry: ./.hooks/generate-mo.sh 18 | -------------------------------------------------------------------------------- /gpg: -------------------------------------------------------------------------------- 1 | # gpg 2 | 3 | Generate a key 4 | $ gpg --expert --gen-key 5 | 6 | Generate a revocation certificate and write it to a file 7 | $ gpg --gen-revoke > rev-certificate.asc 8 | 9 | Edit a key 10 | $ gpg --edit-key 11 | 12 | Delete secret key 13 | $ gpg --delete-secret-key 14 | 15 | Export a backup of the secret keys 16 | $ gpg --export-secret-key > secretkey-gpg.key 17 | 18 | Import secret keys from a backup 19 | $ gpg --import secret-key-gpg.key 20 | 21 | Export the public key 22 | $ gpg --armor --export > public.asc 23 | 24 | List public keys 25 | $ gpg -k 26 | 27 | List private keys 28 | $ gpg -K 29 | -------------------------------------------------------------------------------- /openapi-generator: -------------------------------------------------------------------------------- 1 | # openapi-generator 2 | 3 | # jar installation 4 | ``` 5 | wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar -O openapi-generator-cli.jar 6 | java -jar openapi-generator-cli.jar --help 7 | ``` 8 | 9 | # launch script installation 10 | ``` 11 | curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > openapi-generator-cli 12 | chmod u+x openapi-generator-cli 13 | ``` 14 | 15 | # generate a client library 16 | ``` 17 | java -jar openapi-generator-cli.jar generate -i openapi.json -g bash -o bash 18 | ``` 19 | -------------------------------------------------------------------------------- /.tools/cheat.py: -------------------------------------------------------------------------------- 1 | from sys import stdin 2 | from yaml import load, FullLoader 3 | from pygments.lexers.shell import BashLexer 4 | from pygments.formatters import TerminalFormatter 5 | from pygments import highlight 6 | 7 | 8 | def humanize(cheat): 9 | """ 10 | Renders a human readable cheat. 11 | """ 12 | description = cheat["description"] 13 | command = cheat["command"] 14 | 15 | print(description) 16 | print() 17 | print("\t" + highlight(command, BashLexer(), TerminalFormatter())) 18 | print() 19 | 20 | 21 | if __name__ == "__main__": 22 | list(map(humanize, load(stdin, Loader=FullLoader)["cheats"])) 23 | -------------------------------------------------------------------------------- /bash-if: -------------------------------------------------------------------------------- 1 | 2 | # Syntax 3 | 4 | ``` 5 | if ; then 6 | 7 | elif ; then 8 | 9 | else 10 | 11 | fi 12 | ``` 13 | 14 | The branch's condition ** can be: 15 | 16 | - a *command*, if it succeeds (return code is zero) then the ** evaluates to true: 17 | - `test EXPRESSION`; 18 | - `[ EXPRESSION ]`: a synonym for *test*; 19 | - `(( EXPRESSION ))`: arithmetic expansion; 20 | - a combination of commands separated by control operators: 21 | - ! test EXPR1 && test EXPR2 || test EXPR3; 22 | - a bash's *keyword*: 23 | - `[[ EXPRESSION ]]`: *extended test expression*; 24 | -------------------------------------------------------------------------------- /.github/README.md.mo: -------------------------------------------------------------------------------- 1 | {{DISCLAIMER}} 2 | 3 | [license]: http://creativecommons.org/licenses/by-nc-sa/4.0/ 4 | [license-badge]: https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg?style=for-the-badge 5 | 6 | # cheatsheet 7 | 8 | [![License: Creative Commons by-nc-sa][license-badge]][license] 9 | 10 | {{CHEAT_LISTING}} 11 | 12 | ## License 13 | 14 | This work is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][license]. 15 | 16 | ## Contribute 17 | 18 | ### Rendering of cheatsheet on github 19 | 20 | If you want your cheatsheet to be rendered by Github as a markdown file, 21 | without adding an extension, add this line on top ``. According to `github-linguist`, it should be possible to do this with the 23 | `.gitattributes` but it doesn't seems to work at the moment. 24 | -------------------------------------------------------------------------------- /gitlab-srv: -------------------------------------------------------------------------------- 1 | 2 | # GitLab 3 | 4 | ## Commands 5 | 6 | | command | description | 7 | |----------------------------------|-------------------------------------| 8 | | gitlab-ctl status | Check the status of GitLab services | 9 | | gitlab-ctl restart | Restart GitLab | 10 | | gitlab-rake gitlab:backup:create | Create a backup | 11 | 12 | ## Backup 13 | 14 | - Configuring cron to make daily backups: 15 | 1. edit the configuration file `/etc/gitlab/gitlab.rb` and change 16 | `backup_keep_time` to limit the lifetime of backups; 17 | 2. reconfigure GitLab; 18 | 3. add a cron job as root user `crontab -e`: 19 | ``` 20 | # CRON=1 teels the backup script to suppress all progress output if there are no errors 21 | 0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1 22 | ``` 23 | -------------------------------------------------------------------------------- /linux: -------------------------------------------------------------------------------- 1 | 2 | # linux 3 | 4 | ## Utilities 5 | 6 | Remove password from a PDF file 7 | ``` 8 | qpdf --password=YOURPASSWORD-HERE --decrypt input.pdf output.pdf 9 | ``` 10 | 11 | ## Diff 12 | 13 | List all files that differs between two directories, this will compare the content of the files 14 | ``` 15 | diff --brief --recursive dir1/ dir2/ # GNU long options 16 | diff -qr dir1/ dir2/ # common short options 17 | ``` 18 | 19 | This will compare the files by using an hash algorithm 20 | ``` 21 | rsync -rcnv a/* b/ 22 | ``` 23 | 24 | ## Random 25 | 26 | On `bash`, you can use the `$RANDOM` variable to get a number between 0 and 32767 27 | ``` 28 | $RANDOM 29 | ``` 30 | 31 | On `bash`, you can get a number between 0 and n with 32 | ``` 33 | $((RANDOM % n)) 34 | ``` 35 | 36 | Shuffle the lines of a file and get the first n lines 37 | ``` 38 | cat files.txt | shuf -n 39 | ``` 40 | 41 | Generate a sequence of n shuffled numbers and pick the first one 42 | ``` 43 | shuf -i 1-10 -n1 44 | ``` 45 | 46 | Generate a sequence of random numbers between 1 and 10 and pick only the first one 47 | ``` 48 | shuf -i 1-10 -r -n1 49 | ``` 50 | -------------------------------------------------------------------------------- /sysadmin: -------------------------------------------------------------------------------- 1 | 2 | # System Administration 3 | 4 | ## Users and Groups 5 | 6 | | command | description | 7 | |-----------------------------------------|--------------------------------------------------| 8 | | groupadd | create a new group called *name* | 9 | | usermod -a -G [,] | add an existing user to the group | 10 | | usermod -g | change the user primary group | 11 | | groups | list the groups the current user is assigned to | 12 | | groups | list the groups the selected user is assigned to | 13 | | useradd -G | create the user and assign it a group | 14 | | getent group | list all groups on the system and their members | 15 | 16 | ## Network 17 | 18 | - List all current open ports with relative processe using one of these 19 | commands: 20 | ```bash 21 | sudo lsof -i 22 | sudo netstat -lptu 23 | sudo netstat -tulpn 24 | ``` 25 | -------------------------------------------------------------------------------- /vim: -------------------------------------------------------------------------------- 1 | 2 | # Basics 3 | :q quit vim 4 | :q! quit vim without saving 5 | :w write to 6 | :w! overwrite the file if exit: 7 | :wq write the file and quit 8 | :x quit and save 9 | :r write the content of the file at the current cursor position 10 | :help open the help guide 11 | ZZ write file and quit 12 | 13 | # Wrap selected lines 14 | (in visual mode) gq 15 | 16 | # Tab commands to open and close tabs 17 | :tabedit {file} edit specified file in a new tab 18 | :tabfind {file} open a new tab with filename given, searching the 'path' to find it 19 | :tabclose close current tab 20 | :tabclose {i} close i-th tab 21 | :tabonly close all other tabs (show only the current tab) 22 | 23 | # Tab commands to navigate 24 | :tabs list all tabs including their displayed windows 25 | :tabm 0 move current tab to first 26 | :tabm move current tab to last 27 | :tabm {i} move current tab to position i+1 28 | 29 | :tabn go to next tab 30 | :tabp go to previous tab 31 | :tabfirst go to first tab 32 | :tablast go to last tabs 33 | 34 | # Tab navigation shortcuts 35 | gt go to next tab 36 | gT go to previous tab 37 | {i}gt go to tab in position i 38 | 39 | -------------------------------------------------------------------------------- /jq: -------------------------------------------------------------------------------- 1 | 2 | # jq 3 | 4 | ## Basic filters 5 | 6 | | filter | description | 7 | |--------|--------------------------------------------------------------------------| 8 | | . | identity takes its input and produces it unchanged as output | 9 | | \| | pipe feeds the output of one filter into the input of another | 10 | | .foo | object-identifier produces the value of the given key, or null | 11 | | .[] | this returns all of the elements of the array or the values of an object | 12 | | .[1] | array indexing | 13 | | .[1:5] | array slicing | 14 | | , | the same input is fed into both filters | 15 | 16 | ## Types and values 17 | 18 | | type | description | 19 | |------|-----------------------------------------------------------------------| 20 | | [] | is used to construct arrays, the elements can be any jq expression | 21 | | {} | is used for constructing objects, the values can be any jq expression | 22 | 23 | ## References 24 | - https://stedolan.github.io/jq/manual/ 25 | -------------------------------------------------------------------------------- /adb: -------------------------------------------------------------------------------- 1 | # adb 2 | 3 | # List attached devices 4 | adb devices 5 | 6 | # Push a file from the host to the device 7 | adb push 8 | 9 | # Pull a file from the host to the device 10 | adb pull 11 | 12 | # Reboot the device 13 | adb reboot 14 | 15 | # Install an APK 16 | adb install 17 | 18 | # Uninstall application 19 | adb uninstall 20 | 21 | # List all installed packages on device 22 | adb shell pm list packages 23 | 24 | # Grant a given permission 25 | adb shell pm grant 26 | 27 | # Revoke a given permission 28 | adb shell pm revoke 29 | 30 | # List all properties 31 | adb shell getprop 32 | 33 | # Retrieve the device Android API level 34 | adb shell getprop ro.build.version.sdk 35 | 36 | # Set a property 37 | adb shell setprop debug.hwui.overdraw show 38 | 39 | # Show scheduled alarms 40 | adb shell dumpsys alarm 41 | 42 | # Show info about a given application 43 | adb shell dumpsys package 44 | 45 | # Show info about current visible activity 46 | adb shell dumpsys activity top 47 | 48 | # Show helps on Activity info dump 49 | adb shell dumpsys activity -h 50 | 51 | # Send input text to Android device 52 | adb input text "Send text" 53 | -------------------------------------------------------------------------------- /apt: -------------------------------------------------------------------------------- 1 | 2 | # apt 3 | 4 | ## apt 5 | 6 | | command | description | 7 | |-------------------------------|-----------------------------------------------| 8 | | apt update | update package database | 9 | | apt upgrade | upgrade installed packages | 10 | | apt install NAME[=VERSION] | install the specific version of the package | 11 | | apt remove NAME | remove the package | 12 | | apt purge NAME | remove the package and its configuration files| 13 | | apt remove --purge | | 14 | | apt search QUERY | search the packages that match QUERY | 15 | | apt search --names-only QUERY | search all package's names that match QUERY | 16 | | apt show PACKAGE | show more information about PACKAGE | 17 | | apt list --upgradeable | list all upgradeable packages | 18 | | apt list --installed | list installed packages | 19 | 20 | ## apt-cache 21 | 22 | | command | description | 23 | |-------------------------|-------------------------------------| 24 | | apt-cache pkgnames | list all available packages | 25 | | apt-cache pkgnames NAME | search all packages containing NAME | 26 | -------------------------------------------------------------------------------- /.github/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | [license]: http://creativecommons.org/licenses/by-nc-sa/4.0/ 4 | [license-badge]: https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg?style=for-the-badge 5 | 6 | # cheatsheet 7 | 8 | [![License: Creative Commons by-nc-sa][license-badge]][license] 9 | 10 | [android-studio](android-studio); 11 | [apt](apt); 12 | [bash](bash); 13 | [bash-if](bash-if); 14 | [bash-shortcuts](bash-shortcuts); 15 | [bash-test](bash-test); 16 | [bash-tilde-expansion](bash-tilde-expansion); 17 | [boxes](boxes); 18 | [bpkg](bpkg); 19 | [clion](clion); 20 | [coala](coala); 21 | [curl](curl); 22 | [feh](feh); 23 | [find](find); 24 | [git](git); 25 | [gitlab-api](gitlab-api); 26 | [gitlab-srv](gitlab-srv); 27 | [git.yaml](git.yaml); 28 | [jq](jq); 29 | [linux](linux); 30 | [markdown](markdown); 31 | [newsboat](newsboat); 32 | [openapi-generator](openapi-generator); 33 | [pre-commit](pre-commit); 34 | [pycharm](pycharm); 35 | [python-distribution](python-distribution); 36 | [python-pipenv](python-pipenv); 37 | [python-virtualenvwrapper](python-virtualenvwrapper); 38 | [regex-recipies](regex-recipies); 39 | [sysadmin](sysadmin); 40 | [taskwarrior](taskwarrior); 41 | [terminator](terminator); 42 | [vagrant](vagrant); 43 | [vim](vim); 44 | [vim-goyo](vim-goyo); 45 | [vim-spelling](vim-spelling); 46 | 47 | ## License 48 | 49 | This work is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License][license]. 50 | 51 | ## Contribute 52 | 53 | ### Rendering of cheatsheet on github 54 | 55 | If you want your cheatsheet to be rendered by Github as a markdown file, 56 | without adding an extension, add this line on top ``. According to `github-linguist`, it should be possible to do this with the 58 | `.gitattributes` but it doesn't seems to work at the moment. 59 | -------------------------------------------------------------------------------- /taskwarrior: -------------------------------------------------------------------------------- 1 | 2 | # Syntax 3 | > All taskwarrior's commands follow this general syntax 4 | 5 | ```bash 6 | task <[filter]> <[command]> [ | ] 7 | ``` 8 | 9 | # Commands 10 | 11 | > Some of the most common commands, for a full list visit https://taskwarrior.org/docs/commands/ 12 | 13 | | command | description | 14 | |-------------------------------------------------------|------------------------------------------| 15 | | task <[filter]> modify <[modifications]> | modify one or more task | 16 | | task add DESCRIPTION <[modifications]> | add a new task | 17 | | task <[filter]> start | start working on a task, make active | 18 | | task <[filter]> stop | stop working on a task, no longer active | 19 | | task <[filter]> done <[annotation]> <[modifications]> | complete a task | 20 | 21 | # Reports 22 | 23 | > For more information on report visit https://taskwarrior.org/docs/report.html 24 | 25 | | report | description | 26 | | --- | --- | 27 | | task <[filter]> tags | filtered list of tags | 28 | | task <[filter]> projects | filtered list of projects, with task counts | 29 | | task <[filter]> summary | filtered project summary | 30 | 31 | # Filters 32 | 33 | Filters are used to specify a set of tasks, it is possible to filter 34 | 35 | * by attribute's value `attribute: [value]`, or lack of value `attribute:` 36 | * by `+tag`, or lack of `-tag`, 37 | * or by looking for a match `/regex/`; 38 | 39 | ## Examples 40 | 41 | ```bash 42 | # list all task assigned to the 'home' project 43 | task project:home list 44 | ``` 45 | 46 | ```bash 47 | # list all task with the 'urgent' tag 48 | task +urgent list 49 | ``` 50 | 51 | ```bash 52 | # list all task but the ones included in the project C 53 | task project.not:C 54 | ``` 55 | 56 | # Attributes 57 | > Some of taskwarrior's core attributes, for a full list run the command `task _columns` 58 | 59 | | attribute | description | 60 | |-----------------|----------------------------------| 61 | | project: string | project.subproject | 62 | | due: date | the due date | 63 | | depends: | the id of the task it depends on | 64 | -------------------------------------------------------------------------------- /git.yaml: -------------------------------------------------------------------------------- 1 | type: terminal-command 2 | cheats: 3 | - description: Create a new local branch from a remote one 4 | command: git checkout --track origin/ 5 | - description: Checkout and create a new branch 6 | command: git checkout -b new-branch 7 | - description: Nice looking git log completed with stashes 8 | command: git log --oneline --graph --decorate --all $(git reflog show --format="%h" stash) 9 | - description: Remove a file from the index and keeps it in the local filesystem 10 | command: git rm --cached 11 | - description: Rewind your current HEAD to the previous commit and preserves the changes in your working directory 12 | command: git reset --soft HEAD~1 13 | - description: Rewind your current HEAD to the previous commit and drop the changes 14 | command: git reset --hard HEAD~1 15 | - description: Stash untracked files and unstaged files 16 | command: git stash -k -u 17 | - description: Diff last commit with changes not yet staged 18 | command: git diff 19 | - description: Diff last commit with staged changes 20 | command: git diff --staged 21 | - description: Diff last commit with staged changes (synonym of --staged) 22 | command: git diff --cached 23 | - description: Display a short-format version of your local repository status 24 | command: git status -s 25 | - description: Rebase your current branch onto branch 26 | command: " 27 | git checkout 28 | git rebase origin/ 29 | " 30 | - description: Show a file at a specific version 31 | command: git show : 32 | - description: Add a submodule to your repository 33 | command: git submodule add [] 34 | - description: Add a submodule to your repository with the given logical name 35 | command: git submodule add [] --name 36 | - description: List all repository's submodules 37 | command: git submodule status 38 | - description: Initialize the submodules recorded in the index 39 | command: git submodule init 40 | - description: Clone the submodules 41 | command: git submodule update 42 | - description: Checkout the submodules to the remote tracking branch 43 | command: git submodule update --remote 44 | - description: Initialize and clone the submodule 45 | command: git submodule update --init 46 | - description: Clone a repository and download all submodules 47 | command: git clone --recursive 48 | -------------------------------------------------------------------------------- /vagrant: -------------------------------------------------------------------------------- 1 | 2 | # Vagrant 3 | 4 | Get information about SSH config 5 | ``` 6 | vagrant ssh-config 7 | ``` 8 | 9 | ## Up and running 10 | 11 | ```bash 12 | # Initialize the environment with the specific Box. To find a box, go to https://app.vagrantup.com/boxes/search 13 | vagrant init ubuntu/bionic64 14 | # Start the vagrant environment 15 | vagrant up 16 | # Connect to the machine via SSH 17 | vagrant ssh 18 | ``` 19 | 20 | ## Creating and destroying Virtual Machine 21 | 22 | | command | description | 23 | |--------------------------------|----------------------------------------------------------------------------------------------------------------| 24 | | vagrant init | Create a Vagrant environment with an initial Vagrantfile. | 25 | | vagrant init [] | Specify the box to initilize the Vagrantfile with. To find a box, go to https://app.vagrantup.com/boxes/search | 26 | | vagrant destroy | Destroy the vagrant machine specified | 27 | ## Starting a Virtual Machine 28 | 29 | | command | description | 30 | |----------------|--------------------------------------------------------------| 31 | | vagrant up | starts vagrant environment and provisioning on the first run | 32 | | vagrant resume | resume a suspended machine | 33 | | vagrant reload | restarts vagrant machine and loads new Vagrantfile | 34 | 35 | ## Stopping the Virtual Machine 36 | 37 | | command | description | 38 | |-----------------|----------------------------| 39 | | vagrant halt | stops the vagrant machine | 40 | | vagrant suspend | suspends a virtual machine | 41 | 42 | ## Logging into the Virtual Machine 43 | 44 | | command | description | 45 | |---------------------|---------------------------------------------------------------------------------| 46 | | vagrant ssh | connect to the machine via SSH | 47 | | vagrant ssh BOXNAME | connect to the machine with the given box's name, this works from any directory | 48 | 49 | ## Miscelloneous 50 | 51 | | commmand | description | 52 | |---------------------------------|------------------------------------------| 53 | | vagrant global-status [--prune] | check the status of all vagrant machines | 54 | 55 | ## Configurations 56 | 57 | ### Enable GUI 58 | 59 | To enable the GUI, add the following snippet to your configuration file: 60 | 61 | ```ruby 62 | config.vm.provider "virtualbox" do |v| 63 | v.gui = true 64 | end 65 | ``` 66 | 67 | # References 68 | 69 | - https://gist.github.com/wpscholar/a49594e2e2b918f4d0c4 70 | -------------------------------------------------------------------------------- /bash: -------------------------------------------------------------------------------- 1 | 2 | # Bash 3 | 4 | ```bash 5 | # only parses the script, without running it 6 | bash -n