Skip to content

Instantly share code, notes, and snippets.

@mcoms
mcoms / daily_rates.rb
Created February 17, 2014 15:37
Ruby contractor daily rates (London)
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML.parse open('http://www.itjobswatch.co.uk/contracts/london/ruby.do')
# Inside London...
cells = doc.css('table.summary>tr').find {|tr| tr.css('>td').text =~ /Average daily rate/ }.css 'td'
daily_rates = { three_months: cells[1].text, last_year: cells[2].text, two_years_ago: cells[3].text }
# => {:three_months=>"£425", :last_year=>"£400", :two_years_ago=>"£375"}
@mcoms
mcoms / Dockerfile
Created February 24, 2014 22:34
Wemux demonstration container
# Wemux demonstration container
# =============================
# docker build -t wemux .
# docker run -t -i -d -p 2255:22 wemux
#
# ssh -p 2255 root@<host>
# root : screencast
# ssh -p 2255 user@<host>
# user : password
#
@mcoms
mcoms / ubuntu-minimal-installer.ipxe
Last active August 29, 2015 13:56 — forked from robinsmidsrod/ubuntu-amd64-installer.ipxe
Install Ubuntu 12.04 minimal, i386, non-pae
#!ipxe
dhcp
echo Starting Ubuntu 12.04 i386, non-pae installer for ${hostname}
set base-url http://archive.ubuntu.com/ubuntu/dists/precise-updates/main/installer-i386/current/images/netboot/non-pae/ubuntu-installer/i386
kernel ${base-url}/linux
initrd ${base-url}/initrd.gz
boot ||
# If everything failed, give the user some options
echo Boot from ${base-url} failed
prompt --key 0x197e --timeout 2000 Press F12 to investigate || exit
@mcoms
mcoms / Gemfile
Last active August 29, 2015 14:05
How many combinations of 2 grand piano keys are there?
source 'https://rubygems.org'
gem 'midilib', '~> 2.0.4'
@mcoms
mcoms / helper.rb
Last active August 29, 2015 14:11
Morse code bitstream
def bitstream_to_text(bitstream)
bitstream.join.gsub('111', '-').gsub('1', '.').gsub('0',' ')
end

Keybase proof

I hereby claim:

  • I am mcoms on github.
  • I am mcoms (https://keybase.io/mcoms) on keybase.
  • I have a public key whose fingerprint is 7A08 89B7 BD6A 2DF7 4716 2FBD 8F2D 8965 5AF4 E06A

To claim this, I am signing this object:

@mcoms
mcoms / boot-sonic-pi.sh
Created May 28, 2015 21:55
MPR121 Fruit Piano (Pi-only version)
#!/bin/bash
eval $(dbus-launch --auto-syntax)
/opt/sonic-pi/app/server/bin/sonic-pi-server.rb
@mcoms
mcoms / Gemfile
Created November 8, 2012 00:21
WiringPi PWM Test
source 'https://rubygems.org'
gem 'wiringpi'
@mcoms
mcoms / ntwbfswtf.rb
Created December 14, 2012 19:49
Quick script to use WIT (http://wit.wiimm.de/) to move Wii (WBFS) backup files to a standard directory structure. Works with standard .wbfs files on a FAT/NTFS filesystem, for example.
require 'fileutils'
# Set the directory containing your backup files (they can be in sub-directories of this path)
f = Dir.glob './**/*.wbfs'
f.each do |n|
x = `wwt LIST \"#{n}\"`
if $?.success?
# WBFS containers can have multiple games in them. Here, we select just the first one for naming.
# Nearly always, you will have only backed up a single game per container anyway.
(id, name) = x.split("\n")[3].split(/\s{2,}/)
if id && name
@mcoms
mcoms / Dockerfile
Created October 20, 2015 12:56
Elixir Dockerfile (en_GB.UTF-8)
FROM debian:latest
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq wget locales
RUN dpkg-reconfigure locales && \
locale-gen C.UTF-8 && \
/usr/sbin/update-locale LANG=C.UTF-8
RUN echo 'en_GB.UTF-8 UTF-8' >> /etc/locale.gen && \
locale-gen
ENV LC_ALL C.UTF-8