Skip to content

Instantly share code, notes, and snippets.

Mark Robson roppa

Block or report user

Report or block roppa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@roppa
roppa / javscript.code-snippets.js
Last active Feb 10, 2020
VSCode Test Snippets
View javscript.code-snippets.js
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
@roppa
roppa / game-of-life.js
Last active Aug 29, 2019
Game of life experiment
View game-of-life.js
/**
Quick POC for game of life. Terrible side effects. Actually doing this in Rust but wanted to quickly knock something out in js
**/
let width = 40
function getCells() {
return new Array(width * width).fill(false)
}
let cells = getCells()
@roppa
roppa / pullrepos.sh
Created Dec 12, 2018
Git pull origin master in folder containing many git repos
View pullrepos.sh
#!/bin/bash
for f in $PWD/*;
do
[ -d $f ]
cd "$f"
echo $f
git pull origin master
done;
@roppa
roppa / repo.sh
Created Dec 12, 2018
Bash Pull Repos
View repo.sh
#!/bin/bash
# To run ./repo.sh username
repos=( repo1 repo2 repo3 )
for i in "${repos[@]}"
do
git clone git@github.com:$1/$i.git
done
@roppa
roppa / postgres-cheatsheet.md
Created Aug 8, 2018 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
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)
@roppa
roppa / letsencrypt_2017.md
Created Apr 3, 2018 — forked from cecilemuller/letsencrypt_2019.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)
View letsencrypt_2017.md

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 / watch node.js
Created Mar 1, 2018
Watch files and run tests on change
View watch node.js
npm i -g watch
watch 'npm run test' src
@roppa
roppa / json-path-export.js
Created Mar 1, 2018
Executable script, takes in target json file, output json file, and a string of the json path you want to export, like 'parent.child.child'
View json-path-export.js
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const from = JSON.parse(fs.readFileSync(path.resolve(process.argv[2])).toString());
const to = path.resolve(process.argv[3]);
const jsonPath = process.argv[4].split('.');
function getValueFromPaths(paths, object) {
View The Technical Interview Cheat Sheet.md

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.
You can’t perform that action at this time.