Skip to content

Instantly share code, notes, and snippets.

View spoike's full-sized avatar
👓
I may be slow to respond.

Mikael Brassman spoike

👓
I may be slow to respond.
View GitHub Profile
@spoike
spoike / test.txt
Created June 18, 2020 17:19
Boop Scripts: Convert between WKT and WKB
POINT(2.0 4.0)
010100000000000000000000400000000000001040
LINESTRING(2.0 4.0, 1.0 2.0)
01020000000200000000000000000000400000000000001040000000000000f03f0000000000000040
POLYGON ((30 10, 40 40, 20 40))
### Keybase proof
I hereby claim:
* I am spoike on github.
* I am spoike (https://keybase.io/spoike) on keybase.
* I have a public key ASBid-dWl9jmwlyW9ZQYKyIQxCk4s88XiEd4nsrqno_Gsgo
To claim this, I am signing this object:
@spoike
spoike / git-smart-checkout.sh
Created December 7, 2016 14:06
Git Checkout that remembers previous branch and lets you quickly switch between previous and current branches.
function gch() {
local currentBranch=$(git rev-parse --abbrev-ref HEAD)
local previousFile="$(git rev-parse --show-toplevel)/.git/PREVIOUS_HEAD"
if [ -n "$1" ]; then
echo "$currentBranch" >> $previousFile
git checkout "$@"
else
if [ ! -f "$previousFile" ]; then echo >&2 "ERROR: Missing PREVIOUS_HEAD. Please run gch with 1 argument first."
else
git checkout "$(cat $previousFile | tail --lines=1)"
@spoike
spoike / prompt-emoji-setup
Last active October 28, 2016 13:52 — forked from oshybystyi/random-emoji.zsh-theme
Random emoji theme for zpresto
#
# A minimal emoji theme.
#
# Authors:
# Mikael Brassman
#
# Features:
# - Displays a random emoji as prompt
#
# Usage:
@spoike
spoike / curry.js
Created July 22, 2016 08:41
Simple implementation of a curry for teaching purposes
/*
* curry(fn: Function) => Function
* Simple implementation of currying a function
* Drawbacks:
* - Cannot be reused as stored args is mutable
* - Cannot use placeholders
* - Will not check argument overflow
*/
function curry(fn) {
var arity = fn.length; // check the arity of the given function
@spoike
spoike / gitproxy-socat
Last active March 5, 2022 16:47 — forked from sit/gitproxy-socat
A simple wrapper around socat to use as a git proxy command
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny
@spoike
spoike / use-pkg-node-version.sh
Last active September 18, 2015 11:41
Use node version specified in package.json (engines.node). Uses jq and nvm. Prompts when version is missing if you want to install it.
#!/usr/bin/env bash
#
# Switches to node version with nvm to the one defined in package.json
# Dependencies: nvm, jq
# Usage: Alias this by sourcing with ".", e.g. alias nnn='~/bin/use-pkg-node-version.sh'
if [ ! -e package.json ]; then
echo "Missing package.json file"
return 1
fi
@spoike
spoike / hubot-cumberbatch.coffee
Created March 12, 2015 12:00
Cumberbatch name generator for hubot that does not require the tumblr blog or twitter feed
# Description:
# Benedict Cumberbatch Name Generator
# Names taken from http://benedictcumberbatchgenerator.tumblr.com/
#
# Commands:
# hubot cumberbatch (me) - generates a fairly Cumberbatchy name
_ = require "lodash"
firstnames = ["Bumblebee", "Bandersnatch", "Broccoli", "Rinkydink", "Bombadil", "Boilerdang", "Bandicoot", "Fragglerock", "Muffintop", "Congleton", "Blubberdick", "Buffalo", "Benadryl", "Butterfree", "Burberry", "Whippersnatch", "Buttermilk", "Beezlebub", "Budapest", "Boilerdang", "Blubberwhale", "Bumberstump", "Bulbasaur", "Cogglesnatch", "Liverswort", "Bodybuild", "Johnnycash", "Bendydick", "Burgerking", "Bonaparte", "Bunsenburner", "Billiardball", "Bukkake", "Baseballmitt", "Blubberbutt", "Baseballbat", "Rumblesack", "Barister", "Danglerack", "Rinkydink", "Bombadil", "Honkytonk", "Billyray", "Bumbleshack", "Snorkeldink", "Anglerfish", "Beetlejuice", "Bedlington", "Bandicoot", "Boobytrap", "Blenderdick", "Bentobox", "Anallube", "Pallettown", "Wimbledon", "Buttercup", "Blasphemy", "Syp
@spoike
spoike / hubot-magicball.coffee
Created March 9, 2015 08:00
Ask hubot anything and it will consult the magic 8-ball
# Description:
# Hubot magic 8-ball
#
# Dependencies:
# magicball
#
# Configuration:
# None
#
# Commands:
@spoike
spoike / svg_paths_cheatsheet.md
Last active May 3, 2024 20:54
Cheatsheet for SVG paths

Cheatsheet for SVG Path Data

Straight line commands

+------------+-------------------+--------+
| *M* or *m* | moveto            | (x y)+ |
+------------+-------------------+--------+
| *Z* or *z* | close path        | (none) |
+------------+-------------------+--------+