Skip to content

Instantly share code, notes, and snippets.

Daniel Barlow telent

View GitHub Profile
@telent
telent / gist:1006328
Created Jun 3, 2011
rvm installer failure
View gist:1006328
stargreen@lsip:~$ /usr/local/bin/rvm-installer --version 1.2.0
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 703k 100 703k 0 0 250k 0 0:00:02 0:00:02 --:--:-- 280k
Unrecognized option: --path
Usage:
./scripts/install [options]
@telent
telent / Makefile
Created Jun 6, 2011
All that glitters
View Makefile
TARGET_HOSTNAME=golden
TEMPLATE=template
RELEASE=squeeze
PROXY=http://lsip.4a.telent.net:3142
MIRROR=$(PROXY)/ftp.debian.org/debian
# this must be in a format that works as input to sfdisk
PARTITIONS='1,1044,L,*\n1045,243\n1288,\n;'
all: checkuid0 disk.img
@telent
telent / gist:1119996
Created Aug 2, 2011
Puppetised redmine on Debian, first pass
View gist:1119996
# gist has no puppet syntax highlighting? shurely shome mishtake
# Faced with the choice of writing down in English how I installed redmine so that
# A N Other admin could repeat it at a later date, or writing down in Puppet
# syntax how I would propose to install it, I went for the latter option and
# now I can repeat it at any date I like. Oh, let's run it again!
# This works for me. If you have the Debian Squeeze versions of ruby and puppet,
# it may also work for you. If it breaks, you get to keep both halves. I used
View .bashrc
wsrv() { ruby -r sinatra -e "a=ARGV;;enable :run; set :port, ((i=a.index('-p') and a.slice!(i,2)[1].to_i)||8000); set :public, File.join(Dir.pwd,a[0]||'.'); get '/' do Sinatra::VERSION ; end;" -- $* ;}
View gist:1367050
:; export PATH=/usr/local/rbx/bin/:/home/dan/scripts:/home/dan/bin:/usr/local/lib/android/tools:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin
:; type ruby
ruby is /usr/local/rbx/bin/ruby
:; echo $GEM_HOME
/home/dan/gem
:; rm Gemfile.lock
:; bundle install
Fetching source index for http://rubygems.org/
Using rake (0.9.2.2)
Using log4r (1.1.9)
@telent
telent / gist:1514041
Created Dec 23, 2011
fun with method aliases
View gist:1514041
irb(main):025:0> class Foo; def foo; 42 ;end ; alias :bar :foo ;end
=> nil
irb(main):026:0> Foo.instance_method(:foo)
=> #<UnboundMethod: Foo#foo>
irb(main):027:0> Foo.instance_method(:bar)
=> #<UnboundMethod: Foo#foo>
irb(main):028:0> Foo.instance_method(:foo).name
=> :foo
irb(main):029:0> Foo.instance_method(:bar).name
=> :bar
@telent
telent / core.clj
Created Mar 3, 2012
Audio (mp3/flac/etc) tag support for Clojure via JAudiotagger
View core.clj
(ns onelouder.core
(:import [org.jaudiotagger.audio AudioFileIO]
[org.jaudiotagger.tag FieldKey]))
(defn tags [file]
(let [fields (apply conj {} (map (fn [n] [(keyword (. (. n toString) toLowerCase)) n]) (. FieldKey values)))
tag (. file (getTag))]
(apply conj {}
(filter (fn [[name val]] (and val (not (empty? val))))
(map (fn [[name val]]
View gist:2301106
$ cat connectivity.pl
#!/usr/bin/perl
open(P,"ping dean.stargreen.com|");
my $verbose=grep(@ARGV,"-v");
#warn $verbose;
$|++; while(<P>){
my($seq)=/icmp_req=(\d+)/ ;
print $_ if $verbose;
while($seq>$expected){
print ((scalar gmtime)." missed $expected\n");
@telent
telent / polar.rb
Created Apr 26, 2012
Interface with a polar bluetooth hrm from ruby (linux)
View polar.rb
require 'pp'
require 'socket'
module BluetoothPolarHrm
AF_BLUETOOTH=31 # these are correct for the Linux Bluez stack
BTPROTO_RFCOMM=3
class << self
def connect_bt address_str,channel=1
bytes=address_str.split(/:/).map {|x| x.to_i(16) }
s=Socket.new(AF_BLUETOOTH, :STREAM, BTPROTO_RFCOMM)
View Makefile
DIRS=SOURCES SPECS BUILD BUILDROOT RPMS SRPMS workarea
SPEC=mongodb.spec
VERSION=2.2.1
UPSTREAM=http://downloads.mongodb.org/src/mongodb-src-r$(VERSION).tar.gz
TARBALL=$(shell basename $(UPSTREAM))
all: $(DIRS)
@echo "ready"
distclean:
You can’t perform that action at this time.