Skip to content

Instantly share code, notes, and snippets.

View muffinista's full-sized avatar

Colin Mitchell muffinista

View GitHub Profile
@muffinista
muffinista / data.tsv
Created October 26, 2015 01:44
#NaNoWriMoOpeners from 2015
We can make this file beautiful and searchable if this error is corrected: Any value after quoted field isn't allowed in line 2.
528630387246116864 cstross We were two-thirds of the drive up the M1, almost at Doncaster, when the horse in the trunk finally started to smoulder. #NaNoWriMoOpeners
528588624325922817 drewtoothpaste "You take the red pill," RuPaul said, her palms upturned, "and I show you how deep this Drag Race goes." #NaNoWriMoOpeners
528583934448513024 Mobute Sergeant O'Leary is walking the beat. At night he becomes a Charmander. #NaNoWriMoOpeners
528927801265913856 bltitus These haven’t been used before, have they? #NaNoWriMoOpeners
528927712409579521 bltitus “Call me Ishmael.” #NaNoWriMoOpeners
528927651780890625 bltitus “Happy families are all alike.” #NaNoWriMoOpeners
528927572110106624 bltitus My #NaNoWriMoOpeners - “it was the best of times, it was the worst of times.”
528804452401049600 hunktears Liam reflected on the past week. "Oh my god Harry," he exclaimed as he realized what was happening, "you're in heat!" #NaNoWriMoOpeners
528903713071841280 hydinout Richard Dawkins started warming up the Death Star's lase
class String
def to_full_width
offset = 65248
self.each_byte.collect { |x|
[x == 32 ? 12288 : (x + offset)].pack("U").freeze
}.join("")
end
end

Keybase proof

I hereby claim:

  • I am muffinista on github.
  • I am muffinista (https://keybase.io/muffinista) on keybase.
  • I have a public key whose fingerprint is 9C2C D454 A0EC 5BF2 2A71 C42F 0313 C791 F8D8 2CBE

To claim this, I am signing this object:

@muffinista
muffinista / gist:0d2c21a6d0c37a7402ab
Created September 24, 2014 12:23
1st letter of us place names
mysql> select substr(name, 1, 1) as alpha, count(id) from places group by alpha;
+-------+-----------+
| alpha | count(id) |
+-------+-----------+
| 1 | 7 |
| 2 | 4 |
| 4 | 1 |
| 6 | 1 |
| 9 | 1 |
| A | 7479 |
This file has been truncated, but you can view the full file.
192.99.19.154 - - [12/Jul/2014:03:17:08 -0500] "GET / HTTP/1.1" 200 29308 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
192.99.19.154 - - [12/Jul/2014:03:17:08 -0500] "GET /home HTTP/1.1" 200 29308 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
192.99.19.154 - - [12/Jul/2014:03:17:08 -0500] "GET /the-band--2 HTTP/1.1" 200 23952 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
192.99.19.154 - - [12/Jul/2014:03:17:08 -0500] "GET /tour HTTP/1.1" 200 26522 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
192.99.19.154 - - [12/Jul/2014:03:17:08 -0500] "GET /tour-history HTTP/1.1" 200 26191 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
192.99.19.154 - - [12/Jul/2014:03:17:09 -0500] "GET /the-american-dog-store HTTP/1.1" 200 96317 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"
192.99.19.154 - - [12/Jul/2014:03:17:09 -0500] "GET /music HTTP/1.1" 200 3747
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'chatterbot/dsl'
require 'spacejam'
consumer_key 'key'
@muffinista
muffinista / mitchc2_ebooks.rb
Last active December 29, 2015 13:19
ebook yourself
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'chatterbot/dsl'
require 'marky_markov'
#
# this is the script for the twitter bot mitchc2_ebooks
# generated on 2013-11-26 16:31:48 -0500
@muffinista
muffinista / gist:7374275
Created November 8, 2013 17:10
Infinite Gettysburg Address

As the assassin's bullet pierced his skull, Abraham Lincoln's mind drifted to the Gettysburg Address. As we all know, Lincoln was an early believer in the theory of the multiverse, and as his conciousness slipped away, he drifted amongst infinite parallel universes.

The Gettysburg Address On Earth-1

Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.

Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.

loop do
search "medbotqna SGUL finals" do |tweet|
txt = tweet[:text]
if txt =~ /001/
reply "#{tweet_user(tweet)} Here is your question - SGUL finals", tweet
reply "#{tweet_user(tweet)} Mrs Jones is a 68 year old life long smoker who has an operation next week. To continue please reply with SGUL finals 002", tweet
elsif txt =~ /002/
# stuff to handle 002 here
elsif txt =~ /003/
# stuff to handle 003 here
@muffinista
muffinista / document.rb
Created June 14, 2013 12:59
Parsing wikimedia dumps
class Document < Nokogiri::XML::SAX::Document
attr_accessor :in_page, :in_title, :in_text, :text, :title, :depth, :root
def initialize
@depth = 4
@root = "/opt/wiki"
if File.exist?("/opt/wiki/redirects")
File.delete("/opt/wiki/redirects")
end
if File.exist?("/opt/wiki/titles")