Skip to content

Instantly share code, notes, and snippets.

@gsf
gsf / single-server-bibframe-datastore.svg
Created October 22, 2012 18:59 — forked from jermnelson/wordpress-nelson.html
Code4Lib - Building a Library App Portfolio using MARCR, RDA, and Redis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gsf
gsf / phptags.sh
Created October 19, 2012 18:37
Generate ctags for a php project
#!/bin/sh
find . -name '*.php' | ctags -L -
@gsf
gsf / gist:2903773
Created June 10, 2012 03:53
backup.sh
#!/bin/sh
# See http://www.mikerubel.org/computers/rsync_snapshots/
# SRC is the source, e.g. sally:/mnt/mirror/
SRC="$1:$2"
# BAK is the path to the backup dir, e.g. /var/backups/sally/backup
BAK="/var/backups/$1/backup"
# don't do anything if no ssh connection
@gsf
gsf / gist:2903746
Created June 10, 2012 03:36
HDMirror
mount -v /backup
rsync -vaxE --delete --ignore-errors / /backup/
umount -v /backup
@gsf
gsf / gist:2872787
Created June 5, 2012 05:12
kernel and whiskers
var fs = require('fs')
// kernel
var kernel = require('kernel')
kernel('t2.html', function(err, tmpl) {
if (err) throw err
tmpl({
title: function(cb) {
fs.readFile('bob', cb)
// from K&R section 4.3
#include <stdio.h>
#include <stdlib.h> // for atof()
#include <ctype.h>
#define MAXOP 100 // max size of operand
#define NUMBER '0' // signal that a number was found
#define MAXVAL 100 // max depth of value stack
#define BUFSIZE 100
@gsf
gsf / gist:2576755
Created May 2, 2012 14:05
JSON stringifying and parsing in the Chrome console
> JSON.stringify({aList: '\tthing1\n\tthing2\n'})
"{"aList":"\tthing1\n\tthing2\n"}"
> JSON.parse('{"aList":"\tthing1\n\tthing2\n"}')
▼ SyntaxError: Unexpected token
▶ arguments: Array[1]
▶ get message: function getter() { [native code] }
▶ get stack: function getter() { [native code] }
▶ set message: function setter() { [native code] }
▶ set stack: function setter() { [native code] }
type: "unexpected_token"
@gsf
gsf / gist:2520705
Created April 28, 2012 17:38
vimrc
set expandtab
set hidden
set incsearch
set noshowmatch
set showcmd
set smartcase
set smarttab
set sw=4
set ts=4
@gsf
gsf / gist:1349195
Created November 8, 2011 20:58
coffeescript syntax annoyance
# the function below is called because it is followed by a space and a parameter
robot.load scriptsPath
# the function below will not be called
robot.run
# it must look like this
robot.run()
# i'd rather have a few more parentheses than this brain-jarring inconsistency
@gsf
gsf / gist:1336733
Created November 3, 2011 15:11
Node.js Summon portal
var crypto = require('crypto');
var http = require('http');
var querystring = require('querystring');
var url = require('url');
var util = require('util');
var accessID = 'xxxxx';
var key = 'xxxxxxxxxx';
var host = 'api.summon.serialssolutions.com';
var summon = http.createClient(80, host);