View get_remote_mp3_length.rb
require 'uri'
require 'net/http'
require 'mp3info'
# This works, but is flawed and needs work.
# Why? An ID3v2 tag is not always going to
# be within the first 8K of a file! It can
# be up to 256MB in length apparently.. so
# we need to flexibly scale. But this works
# 99% of the time..
View random_giveaway.rb
# Given a list of items in the 'entries' array, it'll spin through
# some random ones before settling on a "winner" which flashes.
# Yes, the code is terrible, I threw it together on the fly for a Twitter giveaway!
# See for example
# Only dependency is curses, via "gem install curses"
require 'curses'
View youtube.rb
require 'google/apis/youtube_v3'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'fileutils'
require 'json'
require 'redd'
require 'dotenv'
SUBREDDIT = ARGV[0] || 'hiphopheads'
View jobs.csv
Most commonly mentioned relevant terms in 0
engineer 267
software 226
data 156
software engineer 100
remote 82
platform 81
engineering 77
web 76
stack 74
View list.txt
* (Jeff Atwood)
* (Pete Krumins)
* (Mike Fogus)
* (Russ Cox)
* (Fred Lundh)
* (Adam Wiggins)
Podcasts in no particular order:
View websocket_backend.rb
# This file's job is to accept WebSocket connections
# and pass along Redis messages to them
require 'faye/websocket'
class WebSocketBackend
def initialize(app)
@app = app
@clients = []
@running = false
View twitter-rate-limit.rb
# I wanted to get rate limit info from Twitter without there being an error condition
# I can't find a nice way to do this with the Ruby twitter gem, other than this..
rate_limits =, :get, '/1.1/application/rate_limit_status.json').perform
View 01-activerecord.rb
require "active_record"
ActiveRecord::Migration.verbose = false
ActiveRecord::Migration.class_eval do
create_table :played_quizzes, force: true do |t|
t.integer :player_ids, array: true
t.json :quiz_snapshot
View sysv-msg-queue.rb
# A scrappy example library to access the System V message queue
# functionality in macOS. Works on macOS Sierra with Ruby 2.4.
# For more info on sysv message queues:
require 'fiddle'
class MsgQ
LIBC = Fiddle.dlopen('libc.dylib')
View igliker.rb
# igliker.rb - An Instagram mass list liker by pet'rc
# ---------------------------------------------------
# Takes a list of accounts and likes the latest post
# on each by remote controlling a Firefox instance.
# This is quite technical to use and requires you have Ruby
# installed (such as on macOS), as well as Firefox, and
# be happy using the terminal.