Skip to content

Instantly share code, notes, and snippets.

@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: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"
// 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: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)
@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: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 / phptags.sh
Created October 19, 2012 18:37
Generate ctags for a php project
#!/bin/sh
find . -name '*.php' | ctags -L -
@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 / gist:4946810
Created February 13, 2013 18:17
Zoia infrastructure
var exec = require('child_process').exec;
var http = require('http');
var querystring = require('querystring');
var url = require('url');
var port = process.argv[2] || 8751;
http.createServer(function(request, response) {
var url_parts = url.parse(request.url);
if (url_parts.pathname == '/') {
@gsf
gsf / nginx.conf
Last active December 13, 2015 19:28
Nginx settings on aarseth
server {
listen 80;
server_name aarseth;
root /home/gsf/svn/waytohealth/meta/web;
# For passing along to a static site
location ^~ /a/ {
alias /home/gsf/git/Apprenticeship;
}