Skip to content

Instantly share code, notes, and snippets.

Stakeout

Run it like this:

stakeout.rb "clear && rake throne:push_design:db && curl --silent | jsonpretty" '**/*'

#!/bin/sh
KEY="$HOME/.ssh/id_rsa.pub"
if [ ! -f ~/.ssh/id_rsa.pub ];then
echo "private key not found at $KEY"
echo "* please create it with "ssh-keygen -t rsa" *"
echo "* to login to the remote host without a password, don't give the key you create with ssh-keygen a password! *"
exit
fi
[error] [<0.1432.0>] {error_report,<0.23.0>,
{<0.1432.0>,crash_report,
[[{initial_call,{mochiweb_socket_server,acceptor_loop,['Argument__1']}},
{pid,<0.1432.0>},
{registered_name,[]},
{error_info,
{error,
{case_clause,{error,einval}},
[{mochiweb_request,get,2},
{couch_httpd,handle_request,5},
#!/usr/bin/env python
class HeadsetButtonMonitor:
def __init__(self):
self.bus = dbus.SystemBus()
obj = self.bus.get_object('org.freedesktop.Hal',
'/org/freedesktop/Hal/devices/computer_logicaldev_input_1')
iface = dbus.Interface(obj, 'org.freedesktop.Hal.Device')
iface.connect_to_signal("Condition", self.handler)
# Save some test entries
$ curl -X PUT -H 'content-type: text/plain' \
http://localhost:8098/raw/LinkTest/item1 --data-binary "First item"
$ curl -X PUT -H 'content-type: text/plain' \
-H 'Link: </raw/LinkTest/item1>; riaktag="parent"' \
http://localhost:8098/raw/LinkTest/item2 --data-binary "Second item"
$ curl -X PUT -H 'content-type: text/plain' \
#!/usr/bin/env ruby
# Stakeout inspired, Hacked from benschwarz's watch
# Will restart node if any .js files in or below this folder change. Will also restart
# if node exits (with protection to avoid rapid exit loops)
# Assumes your main script is called server.js .
def start_node
puts "\n** Node Started **\n"
@node_pid = Kernel.fork { exec "node server.js" }
end

Exif Date Sync

Because I wanted to use a smart folder to show me photos taken in the last 6 months in my picasa library, I needed to make sure the on disk created attribute matched. Unfortunately it didn't, so I needed to make something to do this.

It didn't seem possible with unix tools, because they dont't have access to the HFS/ Mac specific created metadata. So some googling found a tool that would let me do this, which I've included here as well as a ruby script to read the exif data and call this command

var sys = require('sys')
var http = require('http');
var memcache_lib = require('./memcache');
var memcache = new memcache_lib.Client();//"127.0.0.1", 11211);
memcache.connect(function() {
sys.debug("about to set node test key");
memcache.set("node_test_key", '127.0.0.1');
});
@lstoll
lstoll / memcache.js
Created February 23, 2010 15:19 — forked from jespern/memcache.js
var tcp = require('tcp'),
sys = require('sys');
var crlf = "\r\n";
var crlf_len = crlf.length;
var error_replies = ['ERROR', 'NOT_FOUND', 'CLIENT_ERROR', 'SERVER_ERROR'];
var reply_indicators = {
'get' : ['VALUE', 'END'],
# Need to have this file in your .emacs.d
# http://github.com/lstoll/emacs.d/blob/lstoll/emacs-gui.sh
# This will open the file in GUI Emacs, starting if if's not running
alias ec="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -a ~/.emacs.d/emacs-gui.sh"
# This will open the file in a new frame in the terminal, using the running gui backend
alias et="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -t -a ~/.emacs.d/emacs-gui.sh"
# Open the file in GUI Emacs, in a new frame (OS X 'Window')