Skip to content

Instantly share code, notes, and snippets.

View woudsma's full-sized avatar
🌌
☀️🛰☁️🌈

Tjerk Woudsma woudsma

🌌
☀️🛰☁️🌈
View GitHub Profile
@woudsma
woudsma / dump.md
Last active October 11, 2017 09:12

Install Homebrew

  • xcode-select --install
  • /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install PostgreSQL + PostGIS

  • brew update
  • brew install postgres
  • brew install postgis
  • brew services start postgres
  • createdb paperstorm
  • psql
@woudsma
woudsma / dokku-postgres-postgis.md
Created January 17, 2018 12:38
Using the PostGIS extension on a PostgreSQL database with Dokku

Using the PostGIS extension on a PostgreSQL database with Dokku

docker pull mdillon/postgis:latest  
export POSTGRES_IMAGE="mdillon/postgis"  
export POSTGRES_IMAGE_VERSION="latest"  
dokku postgres:create my-postgis-db
@woudsma
woudsma / k-d-tree.md
Last active February 19, 2018 12:54
Javascript k-d-tree
npm i k-d-tree
const kd = require('k-d-tree')

const data = new Array(1000)
  .fill()
  .map(() => ({
 type: "Point",
#!/bin/bash
echo "Compositing files and ramping up video framerate"
echo "================================================"
rm -rf render && mkdir render
for file in *.mov; do
# Ramp up video framerate, add audio
ffmpeg \

Dokku ACL plugin

# Dokku host
dokku plugin:install https://github.com/dokku-community/dokku-acl.git acl

dokku ssh-keys:add guest guest-key.pub
dokku ssh-keys:list

mkdir ~dokku/.dokkurc
echo "export DOKKU_ACL_ALLOW_COMMAND_LINE=1" >> ~dokku/.dokkurc/acl
@woudsma
woudsma / static-video-live-stream-twitch-ffmpeg.sh
Last active September 17, 2019 19:40
static video to realtime live stream to twitch with ffmpeg - quick n dirty
# Quick and dirty script for streaming a video file to Twitch (as if it were live)
# Requirements: ffmpeg (http://www.ffmpeg.org)
# Copy-paste the function and call it in your command line
# Or add the function to ~/.bash_profile, ~/.zshrc, ..etc.
# Usage:
# twitch STREAM_KEY FILEPATH
# Example:
import math
from bigfloat import *
class LazyCartesianProduct:
def __init__(self, sets, context):
self.sets = sets
self.context = context
self.divs = []
self.mods = []
self.maxSize = BigFloat.exact(1)
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@woudsma
woudsma / gitignore.sh
Last active July 10, 2020 18:35
gitignore command line function
function gitignore() {
TAGS="${@}"
TAGS="${TAGS/mac/macos}"
GITIGNORE_IO_URL="https://www.toptal.com/developers/gitignore/api/${TAGS// /,}"
GITIGNORE_FILE="$(pwd)/.gitignore"
echo "--> Fetching: $GITIGNORE_IO_URL"
echo "--> Writing: $GITIGNORE_FILE"
curl -fsSL "$GITIGNORE_IO_URL" >> "$GITIGNORE_FILE"
}
@woudsma
woudsma / async-trycatch.js
Last active November 27, 2020 22:37
Recursive try/catch statements for async/await functions in a nested object (using .catch)
// Simulates try/catch statements wrapping async functions in (nested) object
// Returns copy of original object with basic promise-rejection handling for async functions using .catch
// Saves the time of writing try/catch statements in every single async function
const trycatch = obj => Object.keys(obj)
.reduce((acc, curr) => ({ ...acc, [curr]: obj[curr] instanceof Function
? (...args) => obj[curr](...args).catch(::console.error)
: trycatch(obj[curr]) }), {})