{"id":15386686,"url":"https://github.com/coderitual/snippets","last_synced_at":"2026-01-30T16:53:15.855Z","repository":{"id":71970508,"uuid":"153263523","full_name":"coderitual/snippets","owner":"coderitual","description":"Personal development snippets useful for day to day work","archived":false,"fork":false,"pushed_at":"2020-11-06T09:48:33.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T00:04:33.329Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coderitual.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-16T10:00:22.000Z","updated_at":"2020-11-06T09:48:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"e27ded22-6cd4-47e0-9798-10fc4b81ccb5","html_url":"https://github.com/coderitual/snippets","commit_stats":{"total_commits":56,"total_committers":1,"mean_commits":56.0,"dds":0.0,"last_synced_commit":"12d7d34a6b99eb2cc08f56725e4821617004b144"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coderitual/snippets","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderitual%2Fsnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderitual%2Fsnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderitual%2Fsnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderitual%2Fsnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderitual","download_url":"https://codeload.github.com/coderitual/snippets/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderitual%2Fsnippets/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28915938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T16:37:38.804Z","status":"ssl_error","status_checked_at":"2026-01-30T16:37:37.878Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T14:50:10.694Z","updated_at":"2026-01-30T16:53:15.817Z","avatar_url":"https://github.com/coderitual.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# snippets\nPersonal development snippets useful for day to day work\n\n### Bash\n```bash\n# Bash clear command line\n# Clean up the line: You can use Ctrl + U to clear up to the beginning.\n# Clean up the line: Ctrl + A Ctrl + K to wipe the current line in the terminal.\n# Cancel the current command/line: Ctrl + C .\n# Recall the deleted command: Ctrl + Y (then Alt + Y )\n# Go at the beginning of the line: Ctrl + A.\n```\n\nFind files with specific text inside\n```bash\ngrep -R -H \"FlowFixType\" ./frontend/src | cut -d ' ' -f 1\n# no duplicates\ngrep -R -H \"FlowFixType\" ./frontend/src | cut -d ' ' -f 1 | sort -u\n```\n\n### GIT\n```bash\n# update with rebase\ngit pull --rebase\n\n# create new branch\ngit checkout -b new_branch\n\n# push local branch to remote\n# -u --set-upstream will set up the tracking information during the push.\ngit push -u origin \u003cbranch\u003e\n\n# remove local branch\ngit branch -d branch_to_delete\n\n# remove remote branch\ngit push origin --delete remote_branch_to_delete\ngit push origin --no-verify --delete branch_name\n\n# discard local modifications\ngit checkout -- file1 file2\ngit checkout -- . \n\n# Revert a specific file to a specific revision\ngit checkout c5f567 -- file1/to/restore file2/to/restore\n\n# avoid repeated merge conflicts\ngit config --global rerere.enabled true\n\n# fix last commit message\ngit commit --amend -m \"New message\"\n\n# add forgotten file to the last commit\ngit add forgotten_file \ngit commit --amend\n\n# undo last two commits, keep changes\ngit reset HEAD~2\n# undo last two commits, discard changes \ngit reset --hard HEAD~2  \n# reset to the origin and discard changes\ngit reset --hard origin/branch\n\n# rebase -\u003e change base(parent) of this branch to another\ngit rebase origin/develop # rebase on develop\ngit rebase -i origin/develop # rebase interactive mode, clean, pickup what you want, super cool\n\n# That removes all local branches that have been deleted from remote (typically GitHub)\n# Add --dry-run to merely see a list first to confirm.\ngit remote prune origin\n\n```\n\n### Docker\n\n#### docker quick tour\n```bash\n# create docker file\ntouch Dockerfile\n\n# build docker image with specified name:tag from current dir\ndocker build -t design-system .\n\n# run docker container exposing port 80 to port 3000 on host\ndocker run --rm -d -p 3000:80/tcp frontend-initial\n\n```\n\n#### docker\n```bash\n\n# build\n# docker build -t shykes/myapp:1.0.2 -t shykes/myapp:latest .\ndocker build -t frontend-initial .\n\n# `run` - command in a new container\n# -i interactive\n# -t pseduo TTY \n# --detach , -d\t\tRun container in background and print container ID\n# --rm automatically remove the container when it exits\n\n# run image\ndocker run -d -p 3000:80 frontend-initial\n\n# exposes 8080/tcp from container to 127.0.0.1:80 on host\ndocker run -p 127.0.0.1:80:8080/tcp ubuntu bas\n\n# runs bash on ubuntu:latest image\ndocker run --name ubuntu_bash --rm -i -t ubuntu bash\n# runs bash on debian:latest image\ndocker run --name test -it debian\n\n# `exec` - run a command in an existing container\ndocker exec -it ubuntu_bash bash\n\n# `ps` - list running containers\n# -a list all containers (not only running ones)\ndocker ps -a\n\n# `rm` - removes container\n# --force , -f\t\tForce the removal of a running container (uses SIGKILL)\n# --link , -l\t\tRemove the specified link\n# --volumes , -v\tRemove the volumes associated with the container\n\ndocker rm $(docker ps -a -q) # remove all stopped containers\ndocker rm -f $(docker ps -a -q) # remove all containers (send SIGKILL to the running ones)\n\n# remove a container and selectively remove volumes\ndocker rm -v hello\n\n# `stop` - stops container\n# stop all the running containers \ndocker stop $(docker ps -a -q)\n\n# `logs` - Fetch the logs of a container\n# --follow , -f\t\tFollow log output\n# --since\t\tShow logs since timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes)\n# --tail\tall\tNumber of lines to show from the end of the logs\n# --timestamps , -t\t\tShow timestamps\n# --until\t\tShow logs before a timestamp (e.g. 2013-01-02T13:23:37) or relative (e.g. 42m for 42 minutes)\ndocker logs service_name -f\n\n# `attach` - Attach local standard input, output, and error streams to a running container\n# Attach isn't for running an extra thing in a container, it's for attaching to the running process.\ndocker attach test\n\n# `prune`\n# --all , -a\t\tRemove all unused images not just dangling ones\n# --force , -f\t\tDo not prompt for confirmation\n# --volumes\t\tPrune volumes\ndocker system prune -a -f --volumes\n\n# remove dangling volumes\ndocker volume rm $(docker volume ls  -q --filter dangling=true)\n```\n#### docker-compose\n```bash\n# `up` - builds, (re)creates, starts, and attaches to containers for a service.\n# -d detached\n# -f config path (it's docker-compose param, not 'up' command)\n# --build build images before starting containers.\ndocker-compose -f ./docker-compose.yml up -d --build\n```\n### NPM\n```bash\n# View registry info\nnpm view express\n```\n\nLink status\n```bash\n# list already linked modules\nnpm ls -g --depth=0 --link=true\n\n# list usage of linked modules inside package\n# check already linked modules\nnpm ls --link=true\n```\n\nLinking\n```bash\n# 1. inside \"module\" folder you want to link to\nnpm link\n\n# 2. inside package folder you want use linked \"module\"\nnpm link module\n\n```\n\nUnlink\n```bash\n# 1. inside package folder where linked module is used\nnpm unlink --no-save module\n\n# 2. inside linked module\nnpm unlink\n```\n\n### Node\n#### Node CLI\n```bash\n# start node with preloaded module\nnode -r ./.pnp.js\n\n# start debugging\n# --inspect Listen on default address and port (127.0.0.1:9229)\n# --inspect=[host:port] Listen on specified address and port\n# --inspect-brk Break before user code starts\n# (legacy from node 7.7.0) --debug or --debug-brk\nnode --inspect\n\n# Spawn child process to run user's script under --inspect flag; and use main process to run CLI debugger.\nnode inspect script.js\n```\n\n### Powershell\n\n```powershell\n# remove folder recursively\nRemove-Item -Recurse -Force some_dir\n# alias\nrm -r -fo some_dir\n```\n\n### SSH\n```bash\n# This starts a ssh tunnel session where a connection to port 9221 on your local machine will be forwarded \n# to port 9229 on remote.example.com. You can now attach a debugger such as Chrome DevTools or Visual Studio Code to localhost:9221\nssh -L 9221:localhost:9229 user@remote.example.com\n```\n\n### Electron\n#### CLI helpers\n```bash\n# Extract asar files\nnpx asar extract app.asar destfolder \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderitual%2Fsnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderitual%2Fsnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderitual%2Fsnippets/lists"}