Skip to content

Instantly share code, notes, and snippets.

Robin Sloan robinsloan

Block or report user

Report or block robinsloan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@robinsloan
robinsloan / sample.py
Created Dec 3, 2019
Just a sampling script
View sample.py
#!/usr/bin/env python3
import fire
import json
import os
import numpy as np
import tensorflow as tf
import re
from wordfilter import Wordfilter
import glob
@robinsloan
robinsloan / delete-dms.js
Created Sep 1, 2019
Code for a bookmarklet to more quickly delete DMs via the Twitter web interface.
View delete-dms.js
// This doesn't work THAT well, but it kinda works... so!
// 1. Make a new bookmarklet with the code below as its URL
// 2. Go to mobile.twitter.com/messages
// 2a. This won't work on the "normal" DM pages, i.e., not the mobile site
// 3. Select a thread
// 3a. So, you see a list of messages now, right?
// 4. Click this bookmarklet :)
// 5. repeat as many times as necessary!
// 6. I think this probably goes without saying, but this doesn't delete your DMs from the *other* person's account. But it does make them invisible to, e.g., someone who hacks your account. Not that that's ever going to happen.
// 6a. It's definitely going to happen
View wiggletech.html
<html>
<head>
<style type="text/css">
body {
font-family: Arial, sans-serif;
font-size: 64px;
}
@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 / 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.
@robinsloan
robinsloan / archival-langoliers.rb
Last active Jun 30, 2019
Tweet delete script using your Twitter archive as an index
View archival-langoliers.rb
require "rubygems"
require "twitter"
require "json"
require "csv"
#require "date"
# things you must configure
TWITTER_USER = "your_twitter_username"
MAX_AGE_IN_DAYS = 7 # anything older than this is deleted
@robinsloan
robinsloan / shh.rb
Last active Oct 14, 2019
Disable RTs from all the people you follow on Twitter.
View shh.rb
require "rubygems"
require "twitter"
# get these from apps.twitter.com
CONSUMER_KEY = "foo"
CONSUMER_SECRET = "bar"
OAUTH_TOKEN = "blee"
OAUTH_TOKEN_SECRET = "baz"
TWITTER_USER = "your_username" # needs to be the one associated with keys above
@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 / unfave.rb
Last active Jul 30, 2019
Unfave script, because why not??
View unfave.rb
#!/usr/bin/env ruby
require "rubygems"
require "twitter"
require "json"
require "faraday"
# things you must configure
TWITTER_USER = "your_username"
# get these from dev.twitter.com
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
You can’t perform that action at this time.