Skip to content

Instantly share code, notes, and snippets.

@zipcode
zipcode / flightdata.json
Created May 5, 2017 01:21
API results on a plane
{
"td_id_decompression":"0",
"td_id_weight_on_wheels":"0",
"td_id_all_doors_closed":"1",
"td_id_x2_pa_state":"0",
"td_id_fltdata_ground_speed":"0518",
"td_id_fltdata_time_to_destination":"0375",
"td_id_fltdata_wind_speed":"-037",
"td_id_fltdata_mach":"0847",
"td_id_fltdata_true_heading":"0299",
@zipcode
zipcode / irc.d.ts
Created February 21, 2015 22:55
node-irc typescript definition
declare module "irc" {
import events = require('events');
export interface Client extends events.EventEmitter {
send(command: string, ...args: string[]): void;
join(channel: string, callback: (arg: any)=>void): void;
part(channel: string, message: string): void;
part(channel: string, callback: (arg: any)=>void, message: string): void;
say(target: string, message: string): void;
ctcp(target: string, type: string, text: string): void;
ctx=new AudioContext();c=ctx.createConvolver();i=document.createElement("input");i.setAttribute("type","file");r=new FileReader();i.onchange=()=>r.readAsArrayBuffer(i.files[0]);r.onload=()=>{ctx.decodeAudioData(r.result,(b)=>{c.buffer=b;c.connect(ctx.destination);m=ctx.createMediaElementSource(document.querySelector("video"));m.connect(c)})};i.click()
@zipcode
zipcode / cloud-config
Last active November 2, 2017 00:22
More generic cloud-config for setting up a bare IPSec/IKEv2 VPN
#cloud-config
# Edit line 52 to list your users
# Edit line 70 to remove --staging and insert your email address
packages:
- strongswan
- strongswan-plugin-eap-mschapv2
- letsencrypt
package_upgrade: true
@zipcode
zipcode / monads.md
Last active April 26, 2017 19:47
Lies we're told about monads

What the hell are monads?

Monads are a useful tool in functional programming. Unfortunately, they're a pain in the ass to understand. I don't think they're actually that complicated, it's just that nobody seems to explain them well.

A monad is a collection which implements a flatMap method. That's it.

flatMap is a function made out of flatten and map:

@zipcode
zipcode / log.txt
Last active February 26, 2017 07:44
ipsec with certificates playthrough
New instance somewhere in the cloud, using Ubuntu:
#cloud-config
packages:
- strongswan
package_upgrade: true
Create root cert locally:
@zipcode
zipcode / ipsec.conf
Last active January 20, 2017 10:06
Quick 'n dirty IPSec w/ keys config
## Install strongswan and use this config file
## How to do key management:
## Make a root CRT. Do this on a secure machine, not the VPN endpoint.
# openssl req -x509 -newkey rsa:4096 -days 90 -subj "/CN=My VPN root" -out root.crt
## Make a conf file
# cat > openssl.cnf << EOF
# [ usr_cert ]
# basicConstraints=CA:FALSE
# nsComment = "OpenSSL Generated Certificate"
@zipcode
zipcode / keybase.md
Last active November 22, 2016 03:20

Keybase proof

I hereby claim:

  • I am zipcode on github.
  • I am zip (https://keybase.io/zip) on keybase.
  • I have a public key whose fingerprint is E325 AF9C 1358 75E7 5804 F35F DE6C 800D 57DC E9F4

To claim this, I am signing this object:

@zipcode
zipcode / primes.clj
Created July 29, 2016 22:53
corecursive infinite list of primes in clojure
(defn divides?
[x y]
(and (= 0 (mod x y)) (not (= x y))))
(def primes
(lazy-cat
[2 3]
(filter
(fn [x]
(not (some
function setps1 {
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
# Hostname (if SSH_TTY is set)
# Directory
# Git branch
# Last command exit status
# $
export PS1='\