Skip to content

Instantly share code, notes, and snippets.


David Jones drj11

View GitHub Profile
View gist:2782236
drj$ cat fixture.js
.reply(200, "<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n<TITLE>BOB</TITLE></HEAD><BODY>\n<H1>Hello from nock</H1>\r\n</BODY></HTML>\r\n", { location: '',
'content-type': 'text/html; charset=UTF-8',
date: 'Thu, 24 May 2012 15:08:01 GMT'
drj$ cat get.js
http.get({host:'',port:80,path:'/',method:'GET'},function(res){res.on('data', function(chunk){console.log('chunk '+chunk)})})
View ccc-gistemp-ushcn-minmax
# execute with:
# curl | sh
set -e
svn co -r $REVISION $D
cd $D
mkdir -p input
View gist:4153938
<p>Hello <i>world</i></p>
drj11 / gist:5636862
Last active Dec 17, 2015
generate username to uid number map
View gist:5636862
# this avoids picking some old empty unused directories that are owned by root
ls -n | sort -n -k 3 | awk '$3>0{print $NF ":x:" $3}'
drj11 / gist:5917057
Last active Dec 19, 2015
Example of how to format dates in go.
View gist:5917057
package main
import (
func main() {
t := time.Now()
fmt.Println(t.Format("2006-01-02 15:04:05 -0700")) // works
strict digraph {
l1 [label="[1, 2]" shape=box];
l2 [label="[2]" shape=box];
p -> l1;
op -> l1;
q -> l2;
label = "after p += q";
ordering = out;
View gist:a8da41eb023217aac8d0
input {
file {
type => "syslog"
path => [ # "/ext/var/log/*.log",
start_position => "beginning"
drj11 / gist:e8e81ef14bc33dcac888
Last active Aug 29, 2015
View gist:e8e81ef14bc33dcac888
#!/usr/bin/env python
import logging
import logging.handlers
import os
import socket
import sys
class UnpickledSocketHandler(logging.handlers.SocketHandler):
drj11 / toadcrlf.c
Created Jul 21, 2014
toadcrlf - add CR before NL
View toadcrlf.c
#include <stdio.h>
int main(void)
int c;
while(1) {
c = getchar();
if(c == EOF) {
View gist:80eda7a821d2923fe627
website,example GeoJSON,notes,",-49.18170,182.98828,-32.28713&startdate=2014-07-18&enddate=2014-07-25",Only 2-D coordinates,"",3-D coordinates,"",is the coordinates field compliant?,"","encoding? (appears to be utf-8, but not declared in header)",,github have their own renderer!
You can’t perform that action at this time.