Skip to content

Instantly share code, notes, and snippets.

@brun0xff
Last active October 21, 2021 20:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brun0xff/f00ba4fa4793cb206ae9140e8288bfee to your computer and use it in GitHub Desktop.
Save brun0xff/f00ba4fa4793cb206ae9140e8288bfee to your computer and use it in GitHub Desktop.
{
"gcp": {
"topic_1": {
"copy-a-file-from-gcp-vm-to-local-machine": "scp -i ~/.ssh/my-ssh-key [LOCAL_FILE_PATH] [USERNAME]@[IP_ADDRESS]:~",
"copy-a-file-from-local-machine-to-gcp-vm": "scp -i ~/.ssh/my-ssh-key [USERNAME]@[IP_ADDRESS]:[REMOTE_FILE_PATH] [LOCAL_FILE_PATH]",
"link_ref": "https://cloud.google.com/compute/docs/instances/transfer-files#transferbrowser"
},
"topic_2": {
"connecting-to-instances-on-gcp": "gcloud compute ssh --project [PROJECT_ID] --zone [ZONE] [INSTANCE_NAME]",
"link_ref": "https://cloud.google.com/compute/docs/instances/connecting-to-instance"
},
"topic_3": {
"add-deletion-protection-vm": "gcloud compute instances update <INSTANCE_NAME> --deletion-protection",
"remove-deletion-protection-vm": "gcloud compute instances update <INSTANCE_NAME> --no-deletion-protection",
"to-delete-vm": "gcloud compute instances delete <example-instance>",
"link_ref": "https://stackoverflow.com/questions/36290006/i-cant-delete-google-compute-instance-in-console"
}
},
"ngroc": {
"topic_1": {
"download-ngroc": "wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip",
"uncompress ": "unzip ngrok-stable-linux-amd64.zip",
"set-tokem-remeber-update": "./ngrok authtoken 1P6imBdBtyGy2yYMbgrA5gaLXlE_tnxDbwRjuvYbEZjqALyJ",
"deploy-mysql-application": "./ngrok tcp 3306",
"link_ref": "https://dashboard.ngrok.com/get-started"
}
},
"postman": {
"install-postman": "https://matheuslima.com.br/como-instalar-o-postman-no-ubuntu"
},
"sql": {
"deduplication_table": "select * from (select array_agg(t order by t.updated_at desc)[offset(0)] data from `pelando-development.pelando_data_lake_development.zoom_product` t group by offer_id)",
"link_ref": "https://stackoverflow.com/questions/36675521/delete-duplicate-rows-from-a-bigquery-table"
},
"docker": {
"delete-container-is-dead": "docker rm -v $(docker ps -a -q -f status=exited)",
"delete-imgaes-loose": "docker rmi $(docker images -f dangling=true -q)",
"clean-forgotten-volumes": "docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker --rm martin/docker-cleanup-volumes",
"link_ref": "https://www.youtube.com/watch?v=hCMcQfGb4cA: 26:21"
},
"bash": {
"topic_1": {
"check all ports in use linux": "sudo lsof -i -P -n | grep LISTEN",
"link_ref": "https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/"
},
"topic_2": {
"to delete all __pycache__ folders on project": "find . -type d -name __pycache__ -exec rm -r {} \+",
"link_ref": "https://stackoverflow.com/questions/28991015/python3-project-remove-pycache-folders-and-pyc-files"
}
},
"postgres-sql": {
"reset_auto_increment": "ALTER SEQUENCE store_url_store_url_id_seq RESTART WITH 1000",
"link_ref": "https://stackoverflow.com/questions/5342440/reset-auto-increment-counter-in-postgres"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment