Skip to content

Instantly share code, notes, and snippets.

@nisitc
nisitc / idle-shutdown.sh
Created April 29, 2021 05:30 — forked from JustinShenk/idle-shutdown.sh
Google Cloud Platform (GCP) instance idle shutdown
#!/bin/bash
# Add to instance metadata with `gcloud compute instances add-metadata \
# instance-name --metadata-from-file startup-script=idle-shutdown.sh` and reboot
# NOTE: requires `bc`, eg, sudo apt-get install bc
# Modified from https://stackoverflow.com/questions/30556920/how-can-i-automatically-kill-idle-gce-instances-based-on-cpu-usage
threshold=0.1
count=0
wait_minutes=60
while true
@nisitc
nisitc / git-cheatsheet.md
Created March 31, 2021 10:34 — forked from Kartones/git-cheatsheet.md
Git cheatsheet

Commands

  • git checkout -b __newbranch__ : get a new branch and switch to it
  • git checkout -b __branchname__ / __branchname__ : get a local copy of a remote existing branch
  • git checkout __branchname__ : switch branch
  • git checkout --orphan __branchname__ : create branch without full history
  • git log -n X -p : show X last commits with diffs
  • git log __branchA__ ^__branchB__ : commits in branch A that aren't in branch B
  • git log --pretty=oneline --stat --all __foldername__ : modified files under a given folder
  • git fetch
@nisitc
nisitc / postgres-cheatsheet.md
Created March 31, 2021 10:33 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@nisitc
nisitc / PY0101EN-3-4-Classes.ipynb
Created December 2, 2019 19:15
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nisitc
nisitc / PY0101EN-3-3-Functions.ipynb
Created November 30, 2019 19:18
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nisitc
nisitc / PY0101EN-2-2-Lists.ipynb
Created November 2, 2019 19:31
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nisitc
nisitc / PY0101EN-3-1-Conditions.ipynb
Created October 31, 2019 13:14
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nisitc
nisitc / PY0101EN-2-4-Dictionaries.ipynb
Created October 30, 2019 22:08
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nisitc
nisitc / PY0101EN-2-3-Sets.ipynb
Created October 30, 2019 20:07
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nisitc
nisitc / PY0101EN-2-1-Tuples.ipynb
Created October 30, 2019 19:04
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.