Skip to content

Instantly share code, notes, and snippets.

View jgoodall's full-sized avatar

John Goodall jgoodall

View GitHub Profile
@jgoodall
jgoodall / index.html
Created September 12, 2013 15:50
intro to d3: basic scatterplot
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.circle {
fill: steelblue;
stroke: '#fff';
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
@jgoodall
jgoodall / index.html
Last active December 22, 2015 22:28
intro to d3: scatterplot using scales and axes
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.circle {
fill: steelblue;
stroke: '#fff';
}
.label {
fill: #777;
}
@jgoodall
jgoodall / index.html
Created September 12, 2013 15:52
intro to d3: scatterplot with transitions
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.circle {
fill: steelblue;
stroke: '#fff';
}
.label {
fill: #777;
}
@jgoodall
jgoodall / index.js
Last active December 27, 2015 02:19
[redis sorted sets](http://redis.io/commands#sorted_set) speed testing with [node-redis](https://github.com/mranney/node_redis). npm install -d node index.js
/* globals require, console, process, setInterval */
'use strict';
var async = require('async')
, redis = require('redis')
, client = redis.createClient();
client.on('error', function(err) {
console.error(err);
});
@jgoodall
jgoodall / post-receive-hook.sh
Created July 18, 2012 15:18
git post-receive hook for sending notifications to notifo
#!/bin/sh
#
# Send git commit notifications to [notifo](http://notifo.com/)
# read the commands from stdin in the git hook
read oldrev newrev refname
# name of the repository
REPO="GIT REPOSITORY NAME"
@jgoodall
jgoodall / pre-commit.sh
Created October 26, 2012 12:39
A git pre-commit hook for node.js projects to lint js files, run tests, and build docs
#!/bin/sh
#
# A git pre-commit hook for node.js projects to
# * lint JavaScript files with [jshint](https://github.com/jshint/jshint/)
# * run [mocha](http://visionmedia.github.com/mocha/) tests from npm, as defined in package.json
# * build docs (e.g. using docco or markdox), as defined in package.json
#
# package.json should have a scripts block that defines how to run tests and build docs:
# "scripts" : {
# "test": "./node_modules/mocha/bin/mocha -R spec"
@jgoodall
jgoodall / things.sh
Created November 12, 2012 18:33
shell script to print things tasks to the screen (geektool)
#!/bin/bash
# useful for [geektool](http://projects.tynsoe.org/en/geektool/)
# jg: made lib_dir generic
# Title: Things Extract Script for GeekTool
# Author: Alex Wasserman
# Description: Extracts the currents items from Things database, stores in a temp file. Outputs tmp file if Things DB is locked in use.
# Things SQL Library
export SQL_LIBRARY="ThingsLibrary.db"
-include .env
PROJECTNAME := $(shell basename "$(PWD)")
GO ?= go
GOBUILD := $(GO) build
GOARCH := amd64
BIN_DIR := ./bin
GOFILES := $(shell find . -name "*.go")
@jgoodall
jgoodall / README.md
Last active July 27, 2023 02:45
Download flag css and convert to 3 char country codes

Download SVG country flags and css, then convert the codes from the iso 3166 two character codes to three character codes.

Usage

./get_flags.sh

Then copy the flag-icon.css file into public/css and the flags directory to public/.

@jgoodall
jgoodall / README.md
Last active September 19, 2023 18:06
This is a sample of how to send some information to logstash via the TCP input from node.js or python.

This is a sample of how to send some information to logstash via the TCP input in nodejs or python. It assumes the logstash host is on 10.10.10.100 and the TCP listening input is 9563.

The logstash.conf should look something like the sample file.

The log message should be a stringified JSON object with the log message in the @message field.

To use, run the node script node sendMessageToLogstash.js, or the python script python sendMessageToLogstash.js