Skip to content

Instantly share code, notes, and snippets.

View WardCunningham's full-sized avatar

Ward Cunningham WardCunningham

  • Cunningham & Cunningham, Inc.
  • Portland, Oregon
View GitHub Profile
@WardCunningham
WardCunningham / README.md
Last active March 30, 2017 14:54
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
WardCunningham / .gitignore
Last active August 29, 2015 14:18
Federation Scraper
logs
sites
.DS_Store
*.numbers
@WardCunningham
WardCunningham / mkbackup.sh
Created March 22, 2015 23:17
rotating backup of federated wiki site
# save a daily backup with a retention of one week
# usage: sh mkbackup.sh forage.ward.fed.wiki.org
site=$1
day=`date +%a`
curl -s http://$site/system/export.json \
> backups/$site.$day.export.json
@WardCunningham
WardCunningham / roster.rb
Last active August 29, 2015 14:13
Recent Changes by Roster
# create page of conversatons
# cron: */5 * * * * (cd wiki/farm-8080/client; CSV='...' ruby roster.rb)
# deploy: scp roster.rb fed.wiki.org:wiki/farm-8080/client/
require 'rubygems'
require 'json'
require 'csv'
require 'pp'
@WardCunningham
WardCunningham / trending.rb
Created December 23, 2014 16:59
Script for Conversation Clubs
@WardCunningham
WardCunningham / cloneAll.sh
Last active August 29, 2015 14:11
Clone and Search all FedWiki Plugins
# make a fresh clone of all plugin repos
rm -rf all
mkdir all
for i in `sh listPlugins.sh`
do (cd all; git clone git@github.com:fedwiki/$i.git)&
done
@WardCunningham
WardCunningham / utime.rb
Created October 21, 2014 14:18
Restore dates lost copying wiki pages
# 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|
File.open(path) do |file|
page = JSON.parse file.read
epoch = page['journal'].last['date'] || early
@WardCunningham
WardCunningham / FloatPrecisionTest.cc
Last active August 29, 2015 14:02
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
WardCunningham / mkplugin.sh
Last active January 22, 2017 23:02
Script to create a stub plugin with stub documentation
#!/bin/sh
# Script to create a stub plugin with build script, tests and documentation.
# See http://plugins.fed.wiki.org/make-plugin-script.html
# Usage: ./mkplugin.sh CoolThing
if [ $# -eq 0 ]
then
echo "Usage: ./mkplugin.sh <new-plugin-name>"