Skip to content

Instantly share code, notes, and snippets.

Avatar

Robin Sloan robinsloan

View GitHub Profile
View wiggletech.html
<html>
<head>
<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"
first_names.zip(last_names) do |first, last|
puts "#{first} #{last}"
end
@robinsloan
robinsloan / gif-to-vid.sh
Created Aug 28, 2017
FFMPEG command to convert GIF to proper MP4
View gif-to-vid.sh
ffmpeg -i this_here.gif -vcodec h264 -y -pix_fmt yuv420p that_there.mov
@robinsloan
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
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
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.
View videopan.py
import subprocess as sp
import numpy as np
import signal
from PIL import Image
### TUKEY WINDOW
# https://leohart.wordpress.com/2006/01/29/hello-world/
def tukey_window(window_length, alpha=0.5):
# Special cases
View stitch.py
from PIL import Image
import glob
import numpy as np
### TUKEY WINDOW
### https://leohart.wordpress.com/2006/01/29/hello-world/
def tukey_window(window_length, alpha=0.5):
# Special cases
if alpha <= 0:
@robinsloan
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"
exit
end
dir = ARGV[0]
@robinsloan
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.