Skip to content

Instantly share code, notes, and snippets.

View jgoodall's full-sized avatar

John Goodall jgoodall

View GitHub Profile
@jgoodall
jgoodall / README.md
Created March 7, 2014 02:11
This script will download web pages and spit out the title, url, and text in a separate file

This script will download web pages and spit out the title, url, and text in a separate file.

Usage:

  1. Create a file articles with newline separated list of URLs to download
  2. Run python extract.py

Prerequisite: newspaper is used for text extraction. Install: pip install newspaper

@jgoodall
jgoodall / README.md
Last active August 29, 2015 14:17 — forked from mbostock/.block

This stacked bar chart is constructed from a CSV file storing the populations of different states by age group. The chart employs conventional margins and a number of D3 features:

@jgoodall
jgoodall / notifo.sh
Created July 18, 2012 14:39
send message to notifo service from shell
#!/bin/bash
# Send messages to [notifo](http://notifo.com/)
# the message is passed from the command line
if [ $# -lt 1 ]; then
echo "Usage: " $0 "'the message to send'"
exit 1
else
message=$1
fi
@jgoodall
jgoodall / setup_git.sh
Created July 27, 2012 13:51
Setup git and configure apache
#!/bin/sh
# Define your LDAP URL
#LDAP_URL=ldaps...
GIT_DIR=/var/lib/git
APACHE_CONFIG_FILE=/etc/httpd/conf.d/git.conf
if [ `whoami` != "root" ]; then
echo "You must run this script as root (sudo $0)"
exit 1
@jgoodall
jgoodall / memoryusage.sh
Created November 12, 2012 18:31
shell script to print memory usage to the screen (geektool)
#!/bin/sh
# useful for [geektool](http://projects.tynsoe.org/en/geektool/)
/usr/bin/vm_stat | sed 's/\.//' | awk '
/free/ {FREE_BLOCKS = $3}
/inactive/ {INACTIVE_BLOCKS = $3}
/speculative/ {SPECULATIVE_BLOCKS = $3}
/wired/ {WIRED_BLOCKS = $4}
END {
@jgoodall
jgoodall / calendar.sh
Created November 12, 2012 18:35
shell script to print a calendar to the screen, highlighting today (geektool)
#!/bin/sh
# useful for [geektool](http://projects.tynsoe.org/en/geektool/)
#
# colorcal - change current day and date via ANSI color escape sequences
# see http://www.termsys.demon.co.uk/vtansi.htm for color codes.
color="\033[1;33m"
underline="\033[4m"
reset="\033[0m"
@jgoodall
jgoodall / updates.sh
Last active December 10, 2015 19:48
update software packages installed in user space
#!/bin/sh
# update software packages installed in user space
# update homebrew
brew update
brew outdated
brew upgrade
# update global node modules
@jgoodall
jgoodall / redis-pub.js
Last active December 11, 2015 17:49
redis pub sub in node (using [redis module](https://github.com/mranney/node_redis))
var redis = require('redis')
, rc = redis.createClient()
for (var i = 0; i < 10; i++) {
var msg = 'message ' + i
console.log('publishing message: ' + msg)
rc.publish('test', msg)
}
@jgoodall
jgoodall / index.html
Last active December 22, 2015 22:09
intro to d3: skeleton
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
  
console.log('append the svg to the body of the page');
var svg = d3.select("body")
.append("svg")
@jgoodall
jgoodall / index.html
Last active December 22, 2015 22:09
intro to d3: dynamic properties
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
// 1. select all p elements (there are none)
// 2. then bind some data to the elements - data always expects an [array],
// d3's selectAll returns a placeholder since there are no p elements yet
// 3. do something with incoming data via the enter() method. since there are