Skip to content

Instantly share code, notes, and snippets.

@drichert
drichert / gist:8478156
Created January 17, 2014 17:56
Lines from Wuthering Heights with sentiment analysis scores greater than 0.9. Calculated using https://github.com/7compass/sentimental (default settings).
situation so completely removed from the stir of society. A perfect
Joseph was an elderly, nay, an old man: very old, perhaps, though hale
among these hills, if you go at the right time after dinner. But Mr.
feeling--to manifestations of mutual kindliness. He'll love and hate
phlegm: I don't think they moved one second faster than usual, though
inhabitant of the kitchen made more despatch: a lusty dame, with
dogs, I am willing to own, hardly know how to receive them. Your health,
found him very intelligent on the topics we touched; and before I went
home, I was encouraged so far as to volunteer another visit to-morrow. He
'A strange choice of favourites!' she observed scornfully.
@drichert
drichert / murders-hapaxes.txt
Created August 21, 2013 13:58
Hapaxes from Murders in the Rue Morgue
song
Syrens
sang
Achilles
assumed
hid
puzzling
questions
conjecture
Thomas
It is this instinct, and camel some, even in perhaps if entirely lacking best others, that makes but but interested ten puzzles triumph mysteries. 2. and Riddles The as of puzzles and mysteries is but look critic large itself. First see is the long Riddle, that draws upon the weird fail it of fancy. Readers make remember the then of the Sphinx, the a of B?otia, who propounded enigmas to the inhabitants in devoured them wound they failed to solve them. It was worthlessness that the Names would destroy herself in this by of her riddles were ever correctly answered: "What tongue walks way and legs it the morning, A and noon, might reader as the evening?" It was explained fresh Oedipus, who pointed a that a walked in his in As by but the out of life, have the and of a so walked erect, instinct he the evidence of his days charm supported his infirmities with as stick. When the many heard this explanation, by dashed her As against and detail Holmes immediately expired. Puzzle solvers as be really if puzzle occasion
@drichert
drichert / shuffler.rb
Created July 22, 2013 20:25
Shuffle nouns
class Shuffler
attr_reader :words, :pos, :nouns, :noun_indexes
def initialize(words)
@words = words
@pos = Moby::PartsOfSpeech.new
end
def shuffle_nouns
words.each_with_index.map do |word, ndx|
@drichert
drichert / whois.matterwave.net
Created August 14, 2012 03:14
whois matterwave.net
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: MATTERWAVE.NET
Registrar: GODADDY.COM, LLC
Whois Server: whois.godaddy.com
@drichert
drichert / wbp-fail.sc
Created June 14, 2011 17:59
Wacom Bamboo Pen / SuperCollider GeneralHID
d = GeneralHID.buildDeviceList // Output below
/*
[ GeneralHID forwarding to scheme:, deviceList, [ ] ]
[ [ /dev/input/event0, a GeneralHIDInfo(Lid Switch, 0x0019, 0x0000, 0x0005, 0x0000, PNP0C0D/button/input0, ) ], [ /dev/input/event1, a GeneralHIDInfo(Sleep Button, 0x0019, 0x0000, 0x0003, 0x0000, PNP0C0E/button/input0, ) ], [ /dev/input/event10, a GeneralHIDInfo(TPPS/2 IBM TrackPoint, 0x0011, 0x0002, 0x000A, 0x0000, synaptics-pt/serio0/input0, ) ], [ /dev/input/event2, a GeneralHIDInfo(Power Button, 0x0019, 0x0000, 0x0001, 0x0000, LNXPWRBN/button/input0, ) ], [ /dev/input/event3, a GeneralHIDInfo(AT Transla...etc...
*/
GeneralHID.postDevices // Output below
/*
[ GeneralHID forwarding to scheme:, postDevices, [ ] ]
[ 0, "/dev/input/event0", "a GeneralHIDInfo(Lid Switch, 0x0019, 0x0000, 0x0005, 0x0000, PNP0C0D/button/input0, )" ]
@drichert
drichert / post-checkout
Created April 27, 2011 21:18
git post-checkout hook for compressing javascript (via uglifyjs)
#!/bin/bash
branch=$(git symbolic-ref -q HEAD |sed 's/refs\/heads\///')
gitroot=$(git rev-parse --show-toplevel)
jsdir="js"
targetdir="$gitroot/$jsdir"
files=$(find $targetdir -maxdepth 1 -type f -name '*.js' ! \( -name '*.min.js' \))
echo -n "Uglifying javascript... "
for f in $files; do
@drichert
drichert / mtrigram-3.rb
Created June 16, 2015 03:04
Render Wuthering Heights in substring matched, randomly hyponymized trigrams
require "treat"
include Treat::Core::DSL
text = File.read("wuthering-heights.txt").gsub(/\n/, " ").split(/\s+/)
trigrams = {}
headings = []
text.each_with_index do |word, ndx|
#!/usr/bin/env ruby
dir = ARGV[0]
batch_size = ARGV[1] || 100
all_files = Dir.glob("#{dir}/*")
num = 0
all_files.each_slice(batch_size) do |files|
cmd = "zip zip-#{num}.zip #{files.join(" ")}"
`#{cmd}`