Last active
February 12, 2025 10:03
-
-
Save shaybensasson/e567421a002de4baade65cce2f295136 to your computer and use it in GitHub Desktop.
description
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [[snippets]] | |
| description = "edit pet configs and snippets" | |
| command = "code ~/.config/pet/snippet.toml" | |
| tag = ["pet"] | |
| output = "" | |
| [[snippets]] | |
| description = "edit snippets_menu jupyter plugin configuration" | |
| command = "code ~/.local/share/jupyter/nbextensions/snippets_menu/my_snippets.js" | |
| tag = ["python", "jupyter"] | |
| output = "" | |
| [[snippets]] | |
| description = "ls: Sort by Date, Human Readable, All Files, Reversed" | |
| command = "ls -haltr" | |
| tag = ["bash", "ls"] | |
| output = "" | |
| [[snippets]] | |
| description = "ls: List only symlinks of current directory" | |
| command = "ls -la . --color=always | grep \"\\->\"" | |
| tag = ["bash", "ls"] | |
| output = "" | |
| [[snippets]] | |
| description = "ls: count files by pattern" | |
| command = "ls -1q <PATTERN=*> | wc -l" | |
| output = "" | |
| [[snippets]] | |
| description = "find files recusive, case insensitive, color, by pattern" | |
| command = "find <where=.> -name \"<pattern=Shay*>\" -type f -exec ls --color {} \\; 2> /dev/null | less -REX" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "grep (search in files) - recursive (-R for symlinks) with (regex) pattern" | |
| command = "grep -rn<caseInsensitive=i><fileNameOnly=l> \"<query=resnet>\" --include \"<pattern=*.py>\" --exclude-dir \"<exclude-dir=site-packages>\" --color=always | less -REX" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "Disk usage UI tool" | |
| command = "duc gui <path=/home/shay>" | |
| tag = ["ubuntu"] | |
| output = "" | |
| [[snippets]] | |
| description = "zip" | |
| command = "zip -r <ZIP=a.zip> <SUBDIR_OR_FILES=*>" | |
| tag = ["bash", "zip"] | |
| output = "" | |
| [[snippets]] | |
| description = "unzip to a destination directory" | |
| command = "unzip <ZIP=a.zip> -d <DEST_DIR>" | |
| tag = ["bash", "zip"] | |
| output = "" | |
| [[snippets]] | |
| description = "uncompress tar.* a destination directory" | |
| command = "tar xvzf <TAR=a.tar> -C <DEST_DIR>" | |
| tag = ["bash", "zip"] | |
| output = "" | |
| [[snippets]] | |
| description = "opens a file or folder or URL in the user's preferred application (from .bashrc)" | |
| command = "open <fileOrFolder>" | |
| output = "" | |
| [[snippets]] | |
| description = "create virtual environment using python3.6" | |
| command = "mkvirtualenv --python=$(which python3.6) <ENV_NAME>" | |
| tag = ["python"] | |
| output = "" | |
| [[snippets]] | |
| description = "run `omniboard` - a `eu_epilepsy` frontend" | |
| command = "omniboard -m <mongo_server=localhost>:<port=27017>:<db=eu_epilepsy>" | |
| tag = ["python"] | |
| output = "" | |
| [[snippets]] | |
| description = "pytest multi-threaded" | |
| command = "pytest -n <n_threads=10>" | |
| tag = ["python"] | |
| output = "" | |
| [[snippets]] | |
| description = "Displays docker inspect json inside chrome browser" | |
| command = "export CONTAINER='<name=container1>' && docker inspect $CONTAINER > /tmp/$CONTAINER.json && google-chrome /tmp/$CONTAINER.json" | |
| tag = ["bash", "docker"] | |
| output = "" | |
| [[snippets]] | |
| description = "docker prunes everything (images, containers, networks and volumes)" | |
| command = "docker system prune --volumes --all <FORCE=--force>; docker rm -vf $(docker ps -a -q) ; docker rmi -f $(docker images -a -q)" | |
| tag = ["bash", "docker"] | |
| output = "" | |
| [[snippets]] | |
| description = "Pip uninstall packages by pattern" | |
| command = "pip freeze | grep <pattern=tensor*> | xargs pip uninstall -y" | |
| tag = ["python"] | |
| output = "" | |
| [[snippets]] | |
| description = "Show Full Linux System Hardware Information" | |
| command = "inxi -F" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "Delete dropbox conflicted copy files" | |
| command = "find . -name \"*conflicted copy*\" -type f -exec /bin/rm {} \\;" | |
| tag = ["bash", "dropbox"] | |
| output = "" | |
| [[snippets]] | |
| description = "PyTorch GPU test" | |
| command = "python -c 'import torch; print(torch.cuda.is_available())'" | |
| tag = ["python", "ml", "dl"] | |
| output = "" | |
| [[snippets]] | |
| description = "TensorFlow GPU test" | |
| command = "python -c \"from tensorflow.python.client import device_lib; print(device_lib.list_local_devices())\"" | |
| tag = ["python", "ml", "dl"] | |
| output = "" | |
| [[snippets]] | |
| description = "Pycharm config pre/post update" | |
| command = "sudo <cmd=cp> /opt/pycharm/bin/pycharm.sh /opt/pycharm/bin/pycharm.sh.bak" | |
| tag = ["pycharm"] | |
| output = "" | |
| [[snippets]] | |
| description = "Sync directories differentially using rsync" | |
| command = "rsync -ah<verbose=v><recursive=r> <dry-run=--dry-run> --progress <source> <dest>" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "Find/List files by date modified recursively" | |
| command = "find <ROOT=.> -type f -name <PATTERN=*.py> -print0 | xargs -0 ls -lth --color" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "tree by pattern with count" | |
| command = "find <ROOT=.> -type d -exec sh -c \\ 'printf -- \"%-20s: \" {}; find {} -maxdepth <MAXDEPTH=1> -type f -name \"<PATTERN=*.mat>\" -printf \"%i\\n\" | wc -l' \\;" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "Save all images in a docker-compose.yaml to a single tar" | |
| command = "docker save -o <TAR_FILE> $(docker-compose config | awk '{if ($1 == \"image:\") print $2;}')" | |
| tag = ["bash", "docker"] | |
| output = "" | |
| [[snippets]] | |
| description = "Remove all containers based on image" | |
| command = "docker ps -a | awk '{ print $1,$2 }' | grep <IMAGE> | awk '{print $1 }' | xargs -I {} docker rm {}" | |
| tag = ["bash", "docker"] | |
| output = "" | |
| [[snippets]] | |
| description = "git log dependency graph oneline" | |
| command = "git log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=<DATE=relative> <GRAPH=--graph>" | |
| tag = ["bash", "git"] | |
| output = "" | |
| [[snippets]] | |
| description = "Loads environment variable from .env file" | |
| command = "load_env <dotenv=.env>" | |
| tag = ["bash", "dotenv", "dot_env", "env_var"] | |
| output = "" | |
| [[snippets]] | |
| description = "List hidden folders" | |
| command = "find -maxdepth 1 -type d -name '.*' | sed 's/^..//'" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "Dropbox ignore folder, https://help.dropbox.com/files-folders/restore-delete/ignored-files" | |
| command = "attr -s com.dropbox.ignored -V <IGNORE=1> <FOLDER=.tox>" | |
| tag = ["bash", "dropbox"] | |
| output = "" | |
| [[snippets]] | |
| description = "docker (overall) size in human readable format" | |
| command = "docker inspect -f \"{{ .Size }}\" <NAME_OR_ID=daskdev/dask> | numfmt --to=iec-i --suffix=B" | |
| tag = ["bash", "docker"] | |
| output = "" | |
| [[snippets]] | |
| description = "docker inspect history for each step size" | |
| command = "docker history <IMAGE_ID> --format \"table{{.ID}}, {{.Size}}, {{.Comment}}, {{.CreatedBy}}\" --no-trunc > <CSV=/tmp/docker-history.csv>" | |
| tag = ["bash", "docker"] | |
| output = "" | |
| [[snippets]] | |
| description = "Determine which process uses a port" | |
| command = "sudo netstat -ltnp | grep -w ':<port=80>'" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "docker remove all images by label author=neurohelp" | |
| command = "docker image ls --filter label=author=neurohelp --quiet | xargs docker image rm <FORCE=--force>" | |
| tag = ["bash", "docker"] | |
| output = "" | |
| [[snippets]] | |
| description = "docker remove all images (but latest) by label author=neurohelp" | |
| command = "docker image ls --filter label=author=neurohelp --filter 'reference=*/*.*' --quiet | xargs docker image rm <FORCE=--force>" | |
| tag = ["bash", "docker"] | |
| output = "" | |
| [[snippets]] | |
| description = "List (sort) files according to size recursively" | |
| command = "du -ah <path=.> | sort -rh | head -<count=10>" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "Tree with filter for filenames" | |
| command = "tree -P '<filter=seizures_index.csv|seizure_index.csv>' --prune" | |
| tag = ["bash"] | |
| output = "" | |
| [[snippets]] | |
| description = "git delete all branches except master" | |
| command = "git branch | grep -v 'master' | xargs git branch -<delete_flag=d>" | |
| tag = ["bash", "git"] | |
| output = "" | |
| [[snippets]] | |
| description = "Batch resize images (https://stackoverflow.com/a/33422725/1640414)" | |
| command = "find . -name <query='*.jpg'> -print0 | xargs -0 convert -resize <resize=50%>" | |
| tag = ["bash"] | |
| output = "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment