View audio_messages_to_mp3.rb
require 'dotenv'
Dotenv.load
require 'telegram/bot'
require 'json'
require 'open-uri'
token = ENV['TELEGRAM_TOKEN']
files = []
Telegram::Bot::Client.run(token) do |bot|
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 https://twitter.com/peterc/status/955955015126003712 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'
Dotenv.load
SUBREDDIT = ARGV[0] || 'hiphopheads'
View jobs.csv
engineer 267
software 226
data 156
software engineer 100
remote 82
platform 81
engineering 77
web 76
stack 74
View list.txt
http://www.fullstackradio.com/
https://www.grc.com/securitynow.htm
http://edgecasesshow.com/
* http://blog.codinghorror.com/ (Jeff Atwood)
* http://www.catonmat.net/ (Pete Krumins)
* http://blog.fogus.me/ (Mike Fogus)
* http://research.swtch.com/ (Russ Cox)
* http://effbot.org/ (Fred Lundh)
* http://adam.herokuapp.com/ (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 = Twitter::REST::Request.new(client, :get, '/1.1/application/rate_limit_status.json').perform
View 01-activerecord.rb
require "active_record"
ActiveRecord::Base.establish_connection('postgres:///testing')
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
end
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:
# https://www.softprayog.in/programming/interprocess-communication-using-system-v-message-queues-in-linux
require 'fiddle'
class MsgQ
LIBC = Fiddle.dlopen('libc.dylib')