Skip to content

Instantly share code, notes, and snippets.


Ben Bleything bleything

Block or report user

Report or block bleything

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bleything / shoes_midi_keyboard.rb
Created Nov 2, 2008 — forked from ahx/shoes_midi_keyboard.rb
A MIDI keyboard in Shoes.
View shoes_midi_keyboard.rb
# A very simple midi-keyboard with Shoes.
# No key-up Event.
# Set Keyboard layout here:
KEYBOARD_LAYOUT = :de # only :de and :us are supported, by now. See MidiKeymap#map_keys!
# You will need a midi input for this.
# On OSX you could use
# and or Garage Band
# enjoy.
View gist:275827
What I Want In A Site Generator: An Essay
by Ben Bleything
Mrs. Anderson's 4th Grade Class
All of the static generators I've looked at so far have some nice
features, but none of them really come together for me. I like what
Jekyll is doing with a flat directory of posts, but I _don't_ like how
you have no control over where those posts go.
bleything / example.rb
Created Mar 11, 2010
an example of Hash[ * ]
View example.rb
require 'pp'
# say you've loaded a csv file with a header row, but you don't have
# access to any nice csv library. All you've got is an array of rows,
# which are also arrays:
# [
# [ a, b, c, d ],
# [ 1, 2, 3, 4 ],
# [ 5, 6, 7, 8 ],
View gist:380070
namespace "/api/v1" do
# mounted at /api/v1/things
get "/things" {}
# mounted at /api/v1/admin/asplode
get "/admin/asplode" {}
View gist:401553
module Enumerable
def frequencies
counts =
self.each{|item| counts[item] +=1}
return counts
View gist:407721
require 'rubygems'
require 'eventmachine'
View README.rdoc


Create and manage users and groups




"id"       : "username",
View flac2mp3
abort "Usage: flac2mp3 FLACFILE" if filename.nil?
`metaflac --export-tags-to=- "#{filename}"`.each_line do |s|
v=s.strip.split '=', 2
v[1].gsub! '"', '\"'
View gist:548025
sorted = stats[key].sort
min = sorted.first
max = sorted.last
sum = sorted.inject(0) {|sum,sample| sum + sample }
avg = sum / sorted.size
# calculate standard deviation
diffs = {|val| val - avg }
squared_diffs = {|val| val ** 2 }
sqd_diff_sum = squared_diffs.inject(0) {|sum,sample| sum + sample }
View gist:551827
nagios-nrpe-server nagios-plugins
nagios-plugins-basic nagios-plugins-standard
}.each do |pkg|
package(pkg) do
# your options here
You can’t perform that action at this time.