code snippets

important disclaimers

by language

javascript (browser)
javascript (node)



An implementation of the Luhn check digit algorithm.
Useful for validating credit card numbers.
Usage: Edit Luhn.java.
View on GitHub



Fetches data from FCPool's JSON API given a user's API key.
Reads the API key from either a file or the command line.
Update: This service appears to be shut down.
Usage: fcpool-api-fetch <api-key>
View on GitHub


Fetches data from ftc.d2.cc's JSON API given a user's API key.
Functions similarly to fcpool-api-fetch, but uses HTTPS.
Update: This service appears to be shut down.
Usage: d2pool-api-fetch <api-key>
View on GitHub


Uses Urban Dictionary's API to find definitions matching the query word.
Inspired by NetBSD's 'wtf' acronym-expanding script. Now a full perl module!
Usage: wtf-urban <word> [-l number]
View on GitHub


Grayscales a given image and stores it as "grayscale.png," all using ImageMagick.
Usage: grayscale <image>
View on GitHub


Generates a pseudorandom image using perl's rand() and ImageMagick.
If dimensions are not provided, a 500x500 image is generated.
Usage: randomimage [WIDTHxHEIGHT]
View on GitHub


Checks the NYC DOE XML API for daily attendance statistics for a given school.
Update: This service appears to be shut down.
Usage: nycdoe-fetch-attendance <"school name" | DBN>
View on GitHub


Generates a QR code image based upon textual user input.
Uses Imager::QRCode.
Usage: mk-qrcode <module size> <text>
View on GitHub


Uses the Twitter REST API (1.1) to tweet fortunes from the "fortune" utility.
Important: You must add your own application/API keys to your environment.
For an example, see robot_fortune on Twitter.
Usage: twitter-fortune-bot
View on GitHub


Converts magnet links to torrent files using magnet2torrent.com.
Important: Bulk transactions through this script may not be appreciated by magnet2torrent's owners.
Update: This service has changed, and this script may no longer work.
Usage: magnet-to-torrent <'magnet link'>
View on GitHub


Scrapes images and other files off of puush using trial-and-error.
Uses MIME headers to detect the correct file extension, defaulting to ".other" if not a text file or common image.
Update: puush appears to be using a new URL schema, and has been IP banning clients that use this script.
Usage: puush-scraper <number of files>
View on GitHub


Fetches PDFs of previous mathematics finals for the given course from UMD's MathNet Test Bank.
Capable of grabbing finals from MATH, AMSC, and STAT courses.
Update: UMD has migrated its database to Google Drive. This script no longer works.
Usage: fetch-math-finals <course code>
View on GitHub


A HexChat plugin that interfaces with gmusicbrowser via DBus.
Grabs information about the current song and ACTIONs it to the channel.
Requires Net::DBus.
Usage: /gmb-nowplaying
View on GitHub


A HexChat plugin that rainbowifies text.
Usage: /rb <text>
View on GitHub


A HexChat plugin that converts text into visually similar homoglyphs.
Usage: /hg <text>
View on GitHub


A HexChat plugin that spaces text out.
Usage: /sp <text>
View on GitHub


A HexChat plugin that makes text red, white, and blue.
Usage: /america <text>
View on GitHub


A HexChat plugin that provides basic text formatting.
Usage: /fmt *italics*, _underline_, and +bold+
View on GitHub


A HexChat plugin that provides fullwidth text conversion.
Usage: /fw <text>
View on GitHub


A HexChat plugin that provides LaTeX symbol substitution.
Usage: \forall x \in \mathbb{R}
View on GitHub


A HexChat plugin that emphasizes👏your👏point👏.
Usage: /clap <text>
View on GitHub


A table implementation of the Verhoeff check digit algorithm.
Can be used to validate a numerical string or generate a check digit for an existing one.
Usage: verhoeff <validate | generate> <number>
View on GitHub


A table implementation of the Damm check digit algorithm.
Can be used to validate a numerical string or generate a check digit for an existing one.
Usage: damm <validate | generate> <number>
View on GitHub


A Universal Product Code (UPC) check digit validator.
Usage: upc <upc>
View on GitHub


A Stock Exchange Daily Official List (SEDOL) ID check digit validator.
Usage: sedol <sedol id>
View on GitHub


An International Standard Serial Number (ISSN) check digit validator.
Usage: issn <issn>
View on GitHub


An ABA Routing Transit Number (RTN) check digit validator.
Usage: aba-rtn <rtn>
View on GitHub


A North American Vehicle Identificarion Number (VIN) check digit validator.
Usage: vin <vin>
View on GitHub



A tiny C99 implementation of the ROT13 Caesarian cipher.
Reads text from standard input.
Usage: rot13
View on GitHub


A C99 implementation of the "Mersenne Twist" pseudorandom number generator.
Usage: Edit mersenne.c.
View on GitHub


A quick and dirty popup box for Batch scripts on Windows.
Usage: mesg.exe <message> [title].
View on GitHub


A small utility for obtaining the permission bits of a file on Linux/Unix systems.
Outputs both standard string notation (i.e. 'rwxrwxrwx') and octal notation (i.e. '755').
Usage: perm <-s|-n <file>>
View on GitHub


Outputs system battery information obtained through sysfs.
Usage: battstat
View on GitHub


A dumb conditional checker that makes asking for user confirmation simple.
Usage: cond [message]
Example: if cond "Continue?" ; then echo "Continuing..." ; fi
View on GitHub


A minor nuisance, copied from the (discontinued) nuisances project.
Ejects disks (or just opens the drive) randomly and repeatedly. Relies on the Windows API.
Usage: eject.exe
View on GitHub


A minor nuisance, copied from the (discontinued) nuisances project.
Randomly activates various control and modifier keys repeatedly. Relies on the Windows API.
Usage: locks.exe
View on GitHub


A small C program that converts Brainfuck source files into C source files.
Uses a 30,000 byte stack, like the original implementation.
Usage: bf <input.bf> <output.c>
View on GitHub


A tiny screenshot program.
Uses Xlib to dump the screen and libpng to save it as a PNG.
Usage: tss <filename>
View on GitHub


Gets information about the given filesystem from /etc/mtab and statvfs(3).
The output is formatted to ease parsing with grep and awk.
Usage: mntinfo <fs name>
Example: mntinfo /dev/sda1 | grep 'f_bsize' | awk '{ print $2 }'
View on GitHub


Monitors a Jellybean Button using ALSA's libesd.
When pressed, executes the supplied command (and arguments).
Modified from Rogach's Piano Pedal Driver (blog post).
Usage: jellybean_trigger <npeaks> <command [arg ...]>
Example: jellybean_trigger 64 echo "click!"
View on GitHub


A "fast", naive implementation of the strings utility.
Doesn't care about executable formats, has no dependencies.
Usage: fstrings [-n size] [file]
Example: fstrings -n 15 /bin/ls
View on GitHub



Collapses the given directory into its parent directory.
Usage: collapse <directory>
View on GitHub


Crawls a given list of IPs, FTPing into them and leaving a message.
Usage: robot-ftp <IP file> <message file>
View on GitHub


Reads the provided QR image, outputting its comments.
Usage: read-qrcode <image>
View on GitHub


A set of aliases for common git SCM commands.
To install, either copy the git-aliases file into your shell's profile or include it with a command like source /path/to/git-aliases.
Usage: Call any of the aliases.
View on GitHub


A minor nuisance, copied from the (discontinued) nuisances project.
Messes with the user's $PATH, placing fake programs or wiping the $PATH altogether.
Usage: pathconfusion
View on GitHub


Generate a skeleton C file containing a main function and some common includes.
Not very useful, except for quickly testing an idea.
Usage: cskel [filename]
Example: vim `cskel test` # opens test.c in vim.
View on GitHub


cskel, but for java skeleton files.
Usage: jskel [filename]
Example: vim `jskel test` # opens test.java in vim.
View on GitHub


A tiny script for posting files/standard input on Hastebin.
Lighter than haste-client, and more versatile than its recommended shell alternative.
Update: This script no longer works.
Usage: haste [file]
Example: my_program | haste.sh # or haste myfile.
View on GitHub


Attempt to upload a file to a few different online filesharing services in sequence.
Currently tries pomf.se and teknik.io before bailing out.
Usage: upload <file>
View on GitHub


Attempt to take a fullscreen or selection screenshot by cascading through common screenshot utilities.
Currently tries gnome-screenshot and scrot before bailing out.
Usage: sscc [-s] <file>
View on GitHub


Converts a directory of images to a single PDF document.
Uses convert from ImageMagick.
Usage: imgs2pdf <directory> <output.pdf>
View on GitHub


Converts FLAC files into MP3s in bulk.
Uses ffmpeg or avconv to perform the conversions.
Usage: flac2mp3 [-sdvh] [-j jobs] [directory]
View on GitHub


Upload to sr.ht and teknik.io.
Heavily modified from Joe Schillinger's poomf.sh (now uguu).
Usage: poomf <-i | -f | -s | -u <file> | -h>
View on GitHub


Plays a URL or file, leveraging youtube-dl and livestreamer if installed.
Usage: play <file or URL>
View on GitHub


Adds album artwork to MP3s in bulk.
Usage: mp3art [-svh] [-f artfile] [-j jobs] [directory]
View on GitHub


Adds album artwork to FLACs in bulk.
Usage: flacart [-svh] [-f artfile] [-j jobs] [directory]
View on GitHub


A basic preprocessor for LaTeX math equations in Markdown.
Reads LaTeX math formatting between @@...@@, converting it into embedded images.
latex.codecogs.com is used to perform the LaTeX to image conversion.
Known problems: Multiple blocks on the same line won't work (thanks, sed).
LaTeX commands that begin with an escape character will also not work (like \texttt).
Usage: mdmath <file> > output.md
View on GitHub


Notifies the user with a popup message in X.
Does so by cascading through various notification programs.
Currently supports xmessage, zenity, and notify-send.
Usage: notify <message>
View on GitHub


Stream various radio stations, identified by callsign.
Stations are loaded from ~/.radiorc. Example here.
Usage: radio <station | list>
View on GitHub


Quick rip an audio CD into a specified format using abcde.
Usage: rip <flac | mp3>
View on GitHub


Adds or removes the 'above' property from an X11 window.
Usage: xontop [-b | -h] # -b removes the property
View on GitHub


Stream This American Life by episode number.
Usage: tal <episode #>
View on GitHub


Prints the X Window ID (xid) associated with a process ID.
Known problem: xwininfo is stupid and may not be reporting correct window IDs.
Usage: pid2xid <pid>
View on GitHub


Watch a Thunderbird profile for new emails, running a command whenever a new one appears.
Known problems: "New email" events are guesses based on inbox writes.
Only works when the user only has one profile.
Usage: watch-thunderbird <cmd>
View on GitHub


Normalize the supplied GIFs to the resolution specified by DIMS.
Usage: normalize-gifs <gifs ...>
Example: DIMS=500x500 normalize-gifs 1.gif 2.gif 3.gif
View on GitHub


Fetch and check out a pull request from GitHub.
Usage: git-fetch-pr <PR #>
Example: git-fetch-pr 123
View on GitHub


Move the last N commits on the current Git branch to a new branch.
Usage: git move-commits <branch> [# of commits]
Example: give move-commits foo-feature 2
View on GitHub


Turns a cloc(1) linecount into a pretty badge.
Usage: clocbadge <FILE|DIR> ...
Example: clocbadge src/ test/
View on GitHub


Adds a centered title to the first 10 seconds of a video.
Usage: fftitle <input> <output> <title>
Example: fftitle my_video.mp4 my_video_titled.mp4 "my title"
View on GitHub


Turns a video into a (soundless) 10x timelapse.
Usage: fftimelapse <input> <output>
Example: fftimelapse my_video.mp4 my_fast_video.mp4
View on GitHub


Create a compact GIF from an input file.
Usage: ffnicegif <input> <output>
Example: ffnicegif my_video.mp4 my_gif.gif
View on GitHub


Concatenate a bunch of inputs into a single output.
Usage: ffcat <output> <input [input ...]>
Example: ffcat my_big_video.mp4 *.mp4
View on GitHub


Rotates an input by 180 degrees (a vertical flip) by setting the rotation flag in the metadata.
Usage: ffflagflip <input> <output>
Example: ffflagflip upside_down.mp4 rightside_up.mp4
View on GitHub


Places a watermark image in the center of a video.
Usage: ffwatermark <input> <watermark> <output>
Example: ffwatermark original.mp4 my_logo.png watermarked.mp4
View on GitHub


Auto-crops a video.
Usage: ffautocrop <input> <output>
Example: ffautocrop original.mp4 cropped.mp4
View on GitHub


Extract a clip (start to end timestamps) from a video.
Usage: ffclip <input> <start> <stop> <output>
Example: ffclip input.mp4 00:00:10 00:00:15 output.mp4
View on GitHub


Remove the beginning of a video.
Usage: ffpreclip <input> <timestamp> <output>
Example: ffpreclip input.mp4 00:00:10 output.mp4
View on GitHub


Remove the end of a video.
Usage: ffpostclip <input> <timestamp> <output>
Example: ffpostclip input.mp4 00:00:10 output.mp4
View on GitHub


Combines one or more stereo channels into a single mono channel.
Usage: ffmono <input> <output>
Example: ffmono left_channel_only.mp4 mono.mp4
View on GitHub


Converts a color video into a monochromatic one.
Usage: ffmonochrome <input> <output>
Example: ffmonochrome color.mp4 monochrome.mp4
View on GitHub


Reverses a video (and its audio).
Usage: ffreverse <input> <output>
Example: ffreverse original.mp4 reversed.mp4
View on GitHub


Turn a vertical video into a 16:9 video with blurred sides.
Usage: ffboxblur <input> <output>
Example: ffboxblur original.mp4 blurred.mp4
View on GitHub


Set up a temporary port forwarding rule to a VirtualBox VM and ssh through it.
Usage: vboxssh <vmname> [user]
Example: vboxssh ubuntu-vm root
View on GitHub



Generates CONTRIBUTORS files for git repositories.
Capable of generating Markdown, CSV, and plain text.
Usage: git-contrib [--markdown | --csv]
View on GitHub


Takes a screenshot of a given website and saves it to the given file.
Uses Grabzit's API to do so.
Spoiler: Grabzit's API sucks and only takes thumbnails without a paid account. Don't use it.
Usage: grabzit-screenshot <url> <file>
View on GitHub


A dumb Sinatra-based server that listens for repo release callbacks from GitHub.
Upon receiving an (authenticated) post, sends a digest to twitter.
For an example, see woodrufw on Twitter.
Usage: twitter-github-bot
View on GitHub


A line-by-line translation of the smtp-spoof python script.
Usage: smtp-spoof-ruby
View on GitHub


An awful script that haphazardly converts HTTPS remotes in git repositories into SSH remotes.
Only works half the time, and isn't very smart. Don't use it.
Usage: git-https2ssh
View on GitHub


A tiny Cinch bot that matches messages containing 'cloud' and substitutes all 'cloud's for 'butt's.
Inspired by the similar 'Cloud To Butt Plus' Chrome plugin.
Usage: cloud2butt-irc <irc.someserver.net> <'#chan1,#chan2,...'>
View on GitHub


Another tiny Cinch bot that makes sure every message is in the form of a 5-7-5 haiku.
If the message does not match the syntax 5 // 7 // 5, the user is kicked.
Usage: haiku-critic <irc.someserver.net> <'#chan1,#chan2...'>
View on GitHub


An Cinch XDCC file fetcher, modified from Mahdi Bchetnia's xdcc.
Released into the public domain.
Update: This script is old and buggy. Use the version linked instead.
Usage: xdcc <irc.someserver.net> <bot_name> <pack_number> [-c channel] [-d directory]
View on GitHub


A Cinch bot that scans a channel for IBIP compliant bots and reports information about them.
Usage: ibip-check <irc.someserver.net> <'#channel'>
View on GitHub


A Cinch bot and control script that spawn a bunch of phishing bots that look like 'NickServ'.
When messaged privately, each bot reports the contents of the message back to a designated channel.
Usage: run # should be edited to change server/channels
View on GitHub


Dumps a file into a socket, base64 encoded and headed by a hash and name.
Useful for quickly shooting data between two machines.
Complemented by socketslurp.
Usage: socketdump <port> <file>
View on GitHub


Reads a base64 encoded file from a socket, validating it using a SHA1 hash.
Useful for quickly shooting data between two machines.
Complemented by socketdump.
Usage: socketslurp <hostname> <port>
View on GitHub


'Glitch' an image by compositing it over itself at various coordinates and with various operations.
Creates the appearance of a corrupted image without damaging the file's integrity.
To glitch multple images together, see images-glitch.
Usage: image-glitch <image> [glitch level]
View on GitHub


'Glitch' multiple images together by repeatedly compositing them at various coordinates and with various operations.
Creates the appearance of a corrupted image without damaging the file's integrity.
To glitch only a single image, see image-glitch.
Usage: images-glitch <glitch level> <file1 file2 [file3 ...]>
View on GitHub


Bork an image by repeatedly applying various filters and effects to it.
Creates the appearance of a corrupted image without damaging the file's integrity.
Usage: image-bork <image> [bork level]
View on GitHub


Scrapes the Alexa.com 'top sites' ranking for the 500 most trafficked websites.
Uses Nokogiri and dumps the output to stdout.
Usage: alexa500 > output
View on GitHub


Scrapes the Fortune 500 companies from uspages.com for their company websites.
Uses Nokogiri and dumps the output to stdout.
Usage: fortune500 > output
View on GitHub


Reads a newline-delimited stream of website addresses from stdin, testing each's markup validity with the Nu HTML Validator.
Uses vnu.jar and formats the output as <site> <warning count> <error count>.
Usage: cat sites | validate_sites > results
View on GitHub


Fetches aggregated crime data from each NYPD precinct in PDF format.
Usage: nypd-crime-data
View on GitHub


Exacerbate artifacts in an image by repeatedly opening and writing it at varying low JPEG qualities.
Creates the appearance of a corrupted image without damaging the file's integrity.
Usage: image-artifact <image> <count>
View on GitHub


Prints today's Eternal September date in asctime format.
Inspired by (and much shorter than) the original sdate.
Usage: sdate
View on GitHub


A quick and dirty raw email forwarder.
Reads addresses and credentials from ~/.email-fwd. Example config here.
Usage: email-fwd
View on GitHub


Fetch UMD dining plan balance data for a given student, by Directory ID.
Usage: umd-dining-balance <username> <password>
View on GitHub


Fetch UMD crime and incident logs for the given month and year and dump them as JSON.
Usage: umd-incident-logs <month> <year>
View on GitHub


Fetch UMD arrest records for the given year and dump them as JSON.
Usage: umd-arrest-ledger <year>
View on GitHub


Send SMS/MMS messages using SMTP gateways provided by cellular companies.
Supports most large (US) cellular providers and reads from stdin.
Reads SMTP credentials and information from ~/.smsrc. Example config here.
Important: Your email provider may not appreciate the volume of mail produced by this script.
Usage: sms <phone number>
View on GitHub


Fetches a filed US patent by number in PDF format.
Usage: uspatent <patent number>
View on GitHub


Get a student's current term grades from Canvas.
Tested on UMD ELMS. Requires an access token (/profile/settings).
Usage: canvas-grades
View on GitHub


Fetch an album's cover art using Last.fm's search API.
Only retrieves large and extralarge images.
Images are saved as cover.png in $CWD.
Usage: albumart <query>
View on GitHub


Adds a YouTube channel to Liferea.
Works with both old (/user/) and new (/channel/)-style YouTube channels.
Important: This script uses liferea-add-feed, which is known to segfault on some versions of Liferea.
Usage: liferea-yt-feed <channel url>
View on GitHub


Adds a YouTube channel to newsbeuter.
Works with both old (/user/) and new (/channel/)-style YouTube channels.
Usage: newsbeuter-yt-feed <channel url>
View on GitHub


A tiny static quote DB, inspired by QDB.
Usage: ssqdb </path/to/quotes.txt> [output directory] [options]
View on GitHub


Composes a list of videos into an NxM "mosaic" of specified dimensions.
Usage: ffmpeg-mosaic [--throttle] <dim> <NxM> <output> <file1 file2 ...>
Example: ffmpeg-mosaic 1920x1080 2x2 mosaic.mp4 source{1..4}.mp4
View on GitHub


Given N GIFs, compose them into random groups such that each group has the given total length.
Then, combine each group of GIFs into a single a single large GIF and save it.
Usage: gif-length-groups [-n <groups>] [-l <len>] [-i <len>] [-d <dir>] <gifs ...>
Example: gif-length-groups -l 60 -d groups *.gif
View on GitHub


Fetch animated GIFs from Giphy and save them to a directory.
Usage: giphy-fetch [--directory <dir>] <query>
Example: giphy-fetch --directory dogs "cute dogs"
View on GitHub


Fetch the weather forecast from Wunderground.
Usage: forecast <query>
Example: forecast washington dc
View on GitHub


Dumps a Ruby script as a compiled sequence of (YARV) instructions.
Usage: rubyvm-dump [--marshal] <file>
Example: rubyvm-dump.rb my-script
View on GitHub


Tags, builds, and pushes a new RubyGem based on a gemspec in $PWD.
Usage: git-gem-release-tag [--dry-run]
Example: git-gem-release-tag
View on GitHub


A tiny terrible SMTP server that pipes emails into a given command.
Usage: [sudo] msmtp <cmd>
Example: msmtp 'cat'
View on GitHub


A small Git commit message linter.
Usage: [sudo] git-lint-commit [commit|-]
Example: git-lint-commit HEAD~1
View on GitHub



Spoofs SMTP transactions with raw sockets.
Allows the user to send email from any address (but not any IP).
Usage: smtp-spoof
View on GitHub


Get Panix dialup numbers for a given area code.
Numbers are scraped from Panix's public numbers.
Usage: panix-numbers <area code>
View on GitHub


Stream a Pandora station into mpv.
Uses Pithos to acquire a stream and Lars Gustäbel's python-mpv to control mpv.
Pandora credentials are read from the environment as PANDORA_EMAIL and PANDORA_PASSWORD.
Usage: pandora-mpv ['station'] # uses QuickMix by default
View on GitHub


Stream a subreddit into mpv.
Uses reddit's RSS API to acquire links and Lars Gustäbel's python-mpv to control mpv.
RSS feeds are parsed with feedparser.
Usage: reddit-mpv <subreddit>
Example: reddit-mpv videos # /r/videos
View on GitHub



Checks each line in each provided file for length.
If the length exceeds 80 characters, spits out a warning for that line.
Usage: linecheck <file1 file2 ...>
View on GitHub


A tiny IRC bot that shows that (GNU) AWK can be used as a general-purpose language.
Currently only responds to .bots, but can be easily extended.
Usage: awkbot <nick> <server> <chan1,chan2,...>
View on GitHub



A stylish style to fix input and textarea elements that Firefox's DeepDark theme makes invisible or difficult to see.
Usage: Install by URL or by copying into stylish.
View on GitHub

javascript (browser)


Removes the onmousedown event from URLs in Google Search results, preventing rewrites.
Compatible with Greasemonkey; install from Greasy Fork here.
View on GitHub

javascript (node)


Takes a screenshot of a given website and saves it to the given file.
Uses node-webshot to do so.
Usage: webshot-screenshot.js <url> <file>
View on GitHub



A basic property list file for using launchd on Homebrew's Samba formula.
Now merged with the actual Samba formula, and therefore no longer needed in stand-alone form.
Usage: Install homebrew.mxcl.smbdist to a directory watched by launchd.
View on GitHub