Skip to content

Instantly share code, notes, and snippets.


Ward Cunningham WardCunningham

View GitHub Profile
WardCunningham /
Last active Mar 30, 2017
Radial Organization Chart

Hover shows employee details, dims more recent hires, and tallies office distribution of similarly senior staff. Adapted from Radial Tidy Tree by M. Bostock. block

WardCunningham / .gitignore
Last active Aug 29, 2015
Federation Scraper
View .gitignore
WardCunningham /
Created Mar 22, 2015
rotating backup of federated wiki site
# save a daily backup with a retention of one week
# usage: sh
day=`date +%a`
curl -s http://$site/system/export.json \
> backups/$site.$day.export.json
WardCunningham / roster.rb
Last active Aug 29, 2015
Recent Changes by Roster
View roster.rb
# create page of conversatons
# cron: */5 * * * * (cd wiki/farm-8080/client; CSV='...' ruby roster.rb)
# deploy: scp roster.rb
require 'rubygems'
require 'json'
require 'csv'
require 'pp'
WardCunningham / trending.rb
Created Dec 23, 2014
Script for Conversation Clubs
View trending.rb
WardCunningham /
Last active Aug 29, 2015
Clone and Search all FedWiki Plugins
# make a fresh clone of all plugin repos
rm -rf all
mkdir all
for i in `sh`
do (cd all; git clone$i.git)&
WardCunningham / utime.rb
Created Oct 21, 2014
Restore dates lost copying wiki pages
View utime.rb
# This script reads all pages in a repository and sets each file's last modification date
# based on dates found in the Journal.
require 'json'
early = 1335324580000
Dir.glob('../pages/*') do |path| do |file|
page = JSON.parse
epoch = page['journal'].last['date'] || early
WardCunningham /
Last active Aug 29, 2015
Reliable Representation of Integers in Floats
#include <iostream>
int main() {
int n = 0;
for (long w=1; w<=10000000000000L; w*=10) {
int k = 0;
for (int i=0; i<1000000; i++) {
long p = (long)(rand()%w);
long q = (float) p;
if (p != q) k++;
WardCunningham /
Last active Jan 22, 2017
Script to create a stub plugin with stub documentation
# Script to create a stub plugin with build script, tests and documentation.
# See
# Usage: ./ CoolThing
if [ $# -eq 0 ]
echo "Usage: ./ <new-plugin-name>"