View postgres-cheatsheet.md

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -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)
View python-cheatsheet.md
View git-cheatsheet.md

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
View mysql-cheatsheet.md

Query/Table Analysis

  • EXPLAIN EXTENDED <tablename>: Describe query execution plan
  • SHOW INDEXES FROM <tablename>: List indexes of a table
  • SHOW DATABASES: Self-explanatory
  • USE <dbname>: Connect to a specific database
  • SHOW TABLES: Self-explanatory- DESCRIBE <tablename>: List table format (columns, etc.)
  • SHOW full processlist: Lists all currently executing queries

Configuration

View CURL-cheatsheet.md
  • XML GET
curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET "http://hostname/resource"
  • JSON GET
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET "http://hostname/resource"
  • JSON PUT
View sublime-text-cheatsheet.md

Keyboard shorcuts

  • CTRL + SHIFT + p: Command panel
  • CTRL + p: File search
  • CTRL + r: Method search inside current file
  • CTRL + g: Go to line #
  • CTRL + SHIFT + [: Fold code
  • CTRL + SHIFT + ]: Unfold code
  • ALT + SHIFT + 2: Double column/file mode
  • ALT + SHIFT + 1: Single column/file mode
View php-cheatsheet.md

Debugging

  • Dump backtrace:
var_dump(debug_backtrace());

Testing

  • Filter PHPUnit to only run one test:
View imagemagick.md

imagemagick

  • Nornalize all images of a folder converting them to jpgs with 90% quality (warning, removes original files):
rename 's/\.JPG$/\.jpg/' *.JPG
rename 's/\.JPEG$/\.jpg/' *.JPEG
rename 's/\.jpeg$/\.jpg/' *.jpeg
mogrify -format jpg *.png
mogrify -resize 1600x1280\> -quality 90 *.jpg
rm *.png
View ruby-misc-cheatsheet.md

Ruby Debugger/Byebug

  • p: execute and dump to output
  • n: next frame
  • u: previous frame
  • c: continue (until next debugger)
  • s: step into
  • irb: start interactive shell (exit to go back to debugging)
  • q: kill process
  • where: print backtrace
View no-css
javascript:%20var%20el,%20i,%20size;%20%20for(i=0,%20size=document.styleSheets.length;%20i<size;%20i++)%20{%20void(document.styleSheets.item(i).disabled=true);%20}%20%20el%20=%20document.getElementsByTagName('script');%20%20while%20(el.length%20>%200)%20{%20%20void(el[0].parentNode.removeChild(el[0]));%20%20}%20%20el%20=%20document.getElementsByTagName('link');%20%20while%20(el.length%20>%200)%20{%20%20void(el[0].parentNode.removeChild(el[0]));%20%20}%20%20el%20=%20document.getElementsByTagName('iframe');%20%20while%20(el.length%20>%200)%20{%20%20void(el[0].parentNode.removeChild(el[0]));%20%20}%20%20el%20=%20document.getElementsByTagName('*');%20%20for%20(%20i=0,%20size=el.length;%20i%20<%20size;%20i++)%20{%20%20void(el[i].style.cssText%20=%20'');%20%20}