Skip to content

Instantly share code, notes, and snippets.

@bamthomas
bamthomas / mod_http_presence.erl
Created December 14, 2011 10:10
module http ejabberd
-module(mod_http_presence).
-behavior(gen_mod).
-include("ejabberd.hrl").
-include("jlib.hrl").
-export([start/2, stop/1, on_presence/4]).
start(Host, _Opts) ->
@bamthomas
bamthomas / index.html
Created December 5, 2011 10:41
webcam AVSP
#!/bin/sh
sudo watch -n 1 streamer -s 1280—720 -f jpeg -o /var/www/avsp/warroom.jpeg
@bamthomas
bamthomas / groupBy.js
Created October 26, 2011 08:49
groupBy javascript
function groupBy(jsonArray, fun) {
return jsonArray.reduce(function(accumulator, object) {
var value = fun(object);
if (Array.isArray(accumulator[value])) {
accumulator[value].push(object);
} else {
accumulator[value] = [object];
}
return accumulator;
}, {});
@bamthomas
bamthomas / index.html
Created June 24, 2011 16:33
webcam war room
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="1">
</head>
<body>
<img src="warroom.jpeg">
</body>
</html>
#!/bin/sh
BACKUP_DIR=/dir/to/backup
SQL_FILE=backup.sql
mysqldump --skip-extended-insert --skip-dump-date \
-uuser -ppwd database |
grep -v 'INSERT INTO `wp_statpress`' > $BACKUP_DIR/$SQL_FILE
rsync -ax /dir/to/wordpress/wp-content/themes/twentyten \