Skip to content

Instantly share code, notes, and snippets.

View telent's full-sized avatar

Daniel Barlow telent

View GitHub Profile
"I wake up early and work hard. I think outside the box. I pay attention to detail. I overcome
limitations. I am the current World and Olympic cycling champion. Please do not hesitate to
contact me if I can be of further assistance"
--------
From: Bont Info <info@bont.com>
Date: Mon, 26 May 2014 15:42:40 +0900
Subject: Re: Bont Z skate package
To: Daniel Barlow <dan@telent.net>
sledge.core=> (defn hey [g] (* 2 g 9))
nil
sledge.core=> (def ha #'hey)
(var sledge.core/hey)
sledge.core=> (ha 2)
"Error evaluating:" (ha 2) :as "sledge.core.ha.call(null,(2));\n"
#!/usr/bin/ruby
# 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
telent / Sequel::Model startup error
Created October 21, 2010 09:56
When I don't have a table name matching the classname, I get cruft
# 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
telent / typescript.sh
Created November 15, 2010 22:47
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
telent / gist:704274
Created November 17, 2010 22:46
Some random notes on Mirah, mostly culled from the mailing list

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

# 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
telent / rsync-wait.sh
Created February 10, 2011 18:03
display gnome notification-area thing whenever rsync is running
#!/bin/bash
function in_progress() {
notify-send "Backup running" "The backup is running. Please don't unplug Fred";
};
#PID=/tmp/hello/rsnapshot-running
#POLL=10
GROUP=users # could make this plugdev or staff or whoever
POLL=120
#!/usr/bin/ruby
require "rticulate-env"
require "sequel"
require "memcache"
require 'pp'
url=URI.parse(Env['rackurl'])
start_port=url.port;
rack_workers=Env['rack_workers'] || 3;
@telent
telent / gist:968586
Created May 12, 2011 14:23
The case of the incredible disappearing file ...
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