Skip to content

Instantly share code, notes, and snippets.

@hyponymous
hyponymous / README.md
Last active August 29, 2015 14:03 — forked from mbostock/.block
Voronoi Color Sampling
@hyponymous
hyponymous / README.md
Last active October 7, 2015 04:34 — forked from mbostock/.block
Letter Scrambles

Run the server:

npm run start

Test the server by loading http://localhost:8080/ in a browser, or run

time curl http://localhost:8080/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<title></title>
<style type="text/css">
@hyponymous
hyponymous / _.md
Created October 5, 2013 17:11
Tributary inlet
#!/usr/bin/env python
#
# File: extract.py
# Author: Michael David Plotz
# Date: Fri Dec 20 21:01:41 PST 2013
#
# Extract images and labels from MNIST database (http://yann.lecun.com/exdb/mnist/)
#
import argparse
#!/usr/bin/env python
#
# File: wason.py
# Author: Michael David Plotz
# Date: Thu Jan 9 23:15:20 PST 2014
#
import re
def is_num(arg):
@hyponymous
hyponymous / base85-pass.sh
Created June 3, 2016 18:31
A one-liner that prints a base85-encoded string containing 120 random bits
head -c 15 </dev/random | python3 -c "import sys, base64; sys.stdout.write('{}\n'.format(base64.b85encode(sys.stdin.buffer.read()).decode('utf-8')))" # ;b85-pass
@hyponymous
hyponymous / edit-conflicted.sh
Created June 3, 2016 18:36
One-liner that opens all files with git conflicts in vim, highlighting the conflict boundaries
vim +/"^[<>|=]\{7}" $(git status -sb | grep "^UU" | cut -d' ' -f 2) # ;edit-conflicted
@hyponymous
hyponymous / three-way.sh
Created June 3, 2016 18:39
One-liner that creates two diffs of a conflicted file (whose name is in the paste buffer) and opens them side by side in vim – for resolving merge conflicts
file=$(pbpaste); git diff -b -M :1:$file :2:$file >~/tmp/left.diff; git diff -b -M :1:$file :3:$file >~/tmp/right.diff; vim -O ~/tmp/left.diff ~/tmp/right.diff # ;three-way