Skip to content

Instantly share code, notes, and snippets.

How to make a script to run in your terminal

  • Locate the path to the interpreter for the language you are writing in with the which command.

      which node
      which python
      which bash
      which ruby
    
  • Add that path as an interpreter directive (using #!) on the first line of your script. For example if which node returned /usr/local/bin/node, the first line of your script should be:

/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@roppa
roppa / .vimrc
Created May 12, 2017 09:56
my vimrc
set autoindent
set indentexpr=off
set expandtab
set tabstop=4
set sw=4
set textwidth=80
set nohls
set noshowmatch
syntax enable

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

Array

Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@roppa
roppa / letsencrypt_2017.md
Created April 3, 2018 16:18 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@roppa
roppa / postgres-cheatsheet.md
Created August 8, 2018 10:20 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

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)
@roppa
roppa / vscode-update-permission-denied.txt
Created June 5, 2020 22:26 — forked from iamcryptoki/vscode-update-permission-denied.txt
Fix Visual Studio Code update error "Could not create temporary directory: Permission denied" on macOS.
sudo rm -Rf ~/Library/Caches/com.microsoft.VSCode.ShipIt
sudo rm -Rf ~/Library/Caches/com.microsoft.VSCodeInsiders.ShipIt
@roppa
roppa / crypto.go
Created March 28, 2022 15:38 — forked from miguelmota/crypto.go
Golang SHA256 hash example
package crypto
import (
"crypto/sha256"
)
// NewSHA256 ...
func NewSHA256(data []byte) []byte {
hash := sha256.Sum256(data)
return hash[:]