Skip to content

Instantly share code, notes, and snippets.

@inky
inky / convert_nfo.py
Created July 11, 2010 13:01
Convert a file from UTF-8 to CP437.
#!/usr/bin/env python
import codecs, sys
try:
infile, outfile = sys.argv[1], sys.argv[2]
except IndexError:
sys.stderr.write('usage: %s input_file output_file\n' % sys.argv[0])
sys.exit(1)
nfo = codecs.open(infile, encoding='utf-8').read()
codecs.open(outfile, 'w', encoding='cp437').write(nfo)
@inky
inky / 1140-extras.css
Created November 22, 2010 22:00
Some additional rules for the 1140px CSS Grid System, to allow whitespace to the left of a column. (Not tested extensively…)
.onepush {
margin-left: 8.65%;
}
.twopush {
margin-left: 17.3%;
}
.threepush {
margin-left: 25.95%;
@inky
inky / udidlist.py
Created October 6, 2012 14:27
List the UDIDs in a provisioning profile. (For iOS/OS X developers.)
import optparse
import os
import plistlib
import sys
PLIST_START = '<?xml'
PLIST_END = '</plist>'
def udidlist(fn):
fn = os.path.expanduser(fn)
@inky
inky / pinboard-export-cronjob.sh
Created April 3, 2012 23:57
Pinboard export
#!/bin/bash
bin=/usr/local/bin
PINBOARD_USERNAME=
PINBOARD_PASSWORD=
cd $HOME/Documents/Backup/Bookmarks && {
file=pinboard.xml
curl -s "https://$PINBOARD_USERNAME:$PINBOARD_PASSWORD@api.pinboard.in/v1/posts/all" > $file
@inky
inky / tumblr-post-notes.php
Created August 4, 2011 22:08 — forked from johnholdun/tumblr-post-notes.php
Retrieve post notes for any tumblr tumblelog
<!--
a styled php version you can throw up on your apache
because i'm some kind of machinist
-->
<style>
/* oooh */
html, body, ul, li { font-family: Verdana; font-size: 14px; line-height: 20px; }
body { width: 400px; margin: 20px auto; background: #333; }
ul { list-style: none; }
li { margin-bottom: 10px; color: #AAA; overflow: hidden; height: 20px; white-space: nowrap; text-overflow: ellipsis; }
@inky
inky / README
Created July 6, 2011 17:46
Jekyll plugin to selectively allow blog posts to use PHP.
Jekyll plugin to selectively allow blog posts to use PHP.
Copy php_posts.rb to your _plugins folder. Set 'php: yes' on a post, and
Jekyll will generate an 'index.php' file for it (rather than 'index.html').
This has only been tested with the following permalink format:
/:year/:title/
@inky
inky / inky.html
Created September 15, 2009 12:58
Theme for http://start.io/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>start.io/{Username}</title>
<style type="text/css">
body {
background: #fff;
color: #000;
font: 300 1em/1.5 'Helvetica Neue', 'Helvetica', sans-serif;
JCRev r => dac;
0.05 => r.mix;
// https://lists.cs.princeton.edu/pipermail/chuck-users/2009-April/004150.html
// $ chuck scales.ck:left.wav:right.wav
if (me.args() > 1) {
dac.chan(0) => Gain g0 => WvOut w0 => blackhole;
dac.chan(1) => Gain g1 => WvOut w1 => blackhole;
0.8 => g0.gain;
0.8 => g1.gain;
#!/usr/bin/env python
HUMAN = 'beep boop'
ROBOT = '011000100110010101100101011100000010000001100010011011110110111101110000'
def splitbin(s):
for i in range(0, len(s), 8):
yield s[i : i + 8]
assert ROBOT == ''.join(bin(ord(c))[2:].zfill(8) for c in HUMAN)
@inky
inky / roman.c
Last active December 18, 2015 05:49
Roman numerals
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
typedef struct RomanChars_type {
char *chars;
unsigned int length;
size_t size;
} RomanChars;