Skip to content

Instantly share code, notes, and snippets.

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');
});

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

#!/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
# 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 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)
[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},
#!/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

Stakeout

Run it like this:

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

#!/bin/bash
cp -R src/main/resources/* target/u.lstoll.net-1.0-SNAPSHOT/WEB-INF/classes
cp -R target/classes/* target/u.lstoll.net-1.0-SNAPSHOT/WEB-INF/classes
cp -R src/main/webapp/* target/u.lstoll.net-1.0-SNAPSHOT/
#!/bin/bash
cd ~/backup.git
TIMESTAMP=`date +%Y-%m-%d.%H:%M:%SUTC`
mysqldump -u drupal_dev -p'ga$f*sbb' -h 127.0.0.1 drupal_dev > ~/backup.git/db/drupal_dev.sql
sudo rsync -a --delete ~drupal-dev/site_data/files/ ~/backup.git/content/drupal_dev
sudo git add *
sudo git commit -a -m "$TIMESTAMP"
sudo git gc
sudo git push origin master