Skip to content

Instantly share code, notes, and snippets.


Robin Sloan robinsloan

View GitHub Profile
View wiggletech.html
<style type="text/css">
body {
font-family: Arial, sans-serif;
font-size: 64px;
View ruby_zip.rb
# zip two collections together then iterate in lockstep
first_names = "Clark", "Bruce", "Diana"
last_names = "Kent", "Wayne", "Troy" do |first, last|
puts "#{first} #{last}"
robinsloan /
Created Aug 28, 2017
FFMPEG command to convert GIF to proper MP4
ffmpeg -i this_here.gif -vcodec h264 -y -pix_fmt yuv420p
robinsloan / autoresponder.txt
Created Nov 30, 2018
Twitter DM autoresponder
View autoresponder.txt
# First,
twurl authorize --consumer-key YOUR_CONSUMER_KEY --consumer-secret YOUR_CONSUMER_SECRET
# Then,
twurl -A 'Content-type: application/json' -X POST /1.1/direct_messages/welcome_messages/new.json -d '{"welcome_message": {"name": "autoresponder", "message_data": {"text": "Hi! I am not currently checking DMs. You can email me instead 👉 YOUR EMAIL HERE"}}}'
# In the response, note the id of the returned welcome message object, because you'll need it in a moment.
robinsloan / LSTMBeam.lua
Created May 25, 2016
Beam search, kinda?
View LSTMBeam.lua
require 'torch'
require 'nn'
local layer, parent = torch.class('nn.LSTM', 'nn.Module')
If we add up the sizes of all the tensors for output, gradInput, weights,
gradWeights, and temporary buffers, we get that a SequenceLSTM stores this many
scalar values:
robinsloan / bad-fax-filter.svg
Created Sep 12, 2018
I like the look of this
View bad-fax-filter.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import subprocess as sp
import numpy as np
import signal
from PIL import Image
def tukey_window(window_length, alpha=0.5):
# Special cases
from PIL import Image
import glob
import numpy as np
def tukey_window(window_length, alpha=0.5):
# Special cases
if alpha <= 0:
robinsloan / makevideo.rb
Last active May 21, 2016
Very brittle, but maybe useful
View makevideo.rb
# for when you have a bunch of images in a dir that are not *quite*
# numbered the way ffmpeg wants them to be, e.g.
# image-1, image-2, ... image-10, image-11, ... image-100, image-101
if ARGV.length < 1
puts "Usage: ruby makevideo.rb name-of-directory-with-all-your-dang-images-in-it"
dir = ARGV[0]
robinsloan / unbroken-spine-id-notes.txt
Created Oct 7, 2012
Unbroken Spine member ID notes
View unbroken-spine-id-notes.txt
Just a few notes for the curious.
* Every number in Mr. Penumbra's 24-Hour Bookstore is a least a little bit meaningful
* The Unbroken Spine member IDs are extra meaningful
* I checked in the roster and Peter Richardson's member ID is 6K6DV8
* I checked in the roster and Patrick Ewing's member ID is 6L9SN2
* Peter and Patrick had different mentors
* Beware the missing letter
More to come, here and there...
You can’t perform that action at this time.