Skip to content

Instantly share code, notes, and snippets.

Daniel Barlow telent

Block or report user

Report or block telent

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
View sinatra-crossbow.rb
# barebones reload-stuff-automatically script for sinatra on linux. In fact
# it doesn't actually restart, because that was causing me problems with socket
# reuse errors. Instead, in the spirit of Unix do-only-one-thing-and-do-it-well,
# it exits and lets the caller restart. You will need to adapt it to start your
# application, because it's currently hardcoded to start mine.
# The name "crossbow" is because it would lose in a fight with a shotgun. But it's
# not as loud.
telent / Sequel::Model startup error
Created Oct 21, 2010
When I don't have a table name matching the classname, I get cruft
View Sequel::Model startup error
# None of my table names match Sequel's expectations re: pluralization, so on
# startup I get one of these per table in my query log. Two questions:
# (1) can I shut it up?
# (2) should I worry that it's not doing the same query for the *correct* dataset name?
# e.g.
irb(main):005:0> class Foo2 < Sequel::Model ; set_dataset :country ;end
I, [2010-10-21T10:54:19.279871 #13554] INFO -- : (0.006494s) SELECT "pg_attribute"."attname" AS "name", format_type("pg_type"."oid", "pg_attribute"."atttypmod") AS "db_type", pg_get_expr("pg_attrdef"."adbin", "pg_class"."oid") AS "default", NOT "pg_attribute"."attnotnull" AS "allow_null", COALESCE(("pg_attribute"."attnum" = ANY("pg_index"."indkey")), false) AS "primary_key" FROM "pg_class" INNER JOIN "pg_attribute" ON ("pg_attribute"."attrelid" = "pg_class"."oid") INNER JOIN "pg_type" ON ("pg_type"."oid" = "pg_attribute"."atttypid") INNER JOIN "pg_namespace" ON ("pg_namespace"."oid" = "pg_class"."relnamespace") LEFT OUTER JOIN "pg_attrdef" ON (("pg_attrdef"."adrelid" = "p
telent / sagepay-admin.rb
Created Nov 4, 2010
Talking to Sagepay Reporting & Admin API from Ruby
View sagepay-admin.rb
require 'patron'
require 'time'
require 'active_support/core_ext/hash.rb'
require 'digest/md5'
require 'nokogiri'
module SagePay;end
class SagePay::Admin
def initialize(args)
telent /
Created Nov 15, 2010
mirahndroid error typescript
:; mkdir for_jackoway
:; cd for_jackoway/
:; rvm jruby
:; type mirahc
mirahc is /home/dan/.rvm/gems/jruby-1.5.5/bin/mirahc
:; type mirahndroid
mirahndroid is /home/dan/.rvm/gems/jruby-1.5.5/bin/mirahndroid
:; android list
Available Android targets:
telent / gist:704274
Created Nov 17, 2010
Some random notes on Mirah, mostly culled from the mailing list
View gist:704274

Stuff in Ruby that is/isn't supported, or is different

=begin / =end

Rib Rdb writes: "The new parser doesn't support this". Use single line comments instead

The object model

The ruby object model is not the same as the java object model. The

View aserver.rb
# put this file in the same directory as your media, and run it
# then run e.g. mplayer -playlist http://mediaserver:5656/flac/Various-Sasha\*/*
# it wants a directory name or a shell wildcard.
# No attempt has been made to make this secure. Do not use it on an internet-facing host, or god will kill your kittens
require 'sinatra'
set :port,5656
telent /
Created Feb 10, 2011
display gnome notification-area thing whenever rsync is running
function in_progress() {
notify-send "Backup running" "The backup is running. Please don't unplug Fred";
GROUP=users # could make this plugdev or staff or whoever
View rackup.multiprocess
require "rticulate-env"
require "sequel"
require "memcache"
require 'pp'
rack_workers=Env['rack_workers'] || 3;
telent / gist:968586
Created May 12, 2011
The case of the incredible disappearing file ...
View gist:968586
GingerBreak got me a shell with uid 0. Now what?
/proc/mounts says
/dev/block/mmcblk0p25 /system ext4 ro,relatime,barrier=1,data=ordered 0 0
# mount -o remount,rw /dev/block/mmcblk0p25 /system
# cat /system/bin/sh > /system/rootsh
# chmod 4711 /system/rootsh
# ls -l /system/rootsh
-rws--x--x root shell 82840 2011-05-12 15:08 rootsh
telent / rackup.rb
Created May 28, 2011
Thin-Prefork - a real-world example
View rackup.rb
#!/usr/bin/env ruby
require 'rticulate'
require 'thin/prefork'
require 'thin/prefork/project'
require 'projectr/watch_changes'
debugging = ARGV.member?("-d")
if debugging then
You can’t perform that action at this time.