Skip to content

Instantly share code, notes, and snippets.

View sleepyfox's full-sized avatar
:shipit:

@sleepyfox sleepyfox

:shipit:
  • TypeError
  • The Midlands
View GitHub Profile
@sleepyfox
sleepyfox / webdriver-test.py
Created May 16, 2012 10:10
Simple Selenium example in Python
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
import time
# Create a new instance of the Firefox driver
driver = webdriver.Firefox()
# go to the google home page
driver.get("http://www.google.com")
@sleepyfox
sleepyfox / dropbox
Created June 11, 2012 15:12
Ubuntu Linux init.d startup script for DropBox
#!/bin/sh
#dropbox service
DROPBOX_USERS="user1 user2"
DAEMON=.dropbox-dist/dropbox
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`
@sleepyfox
sleepyfox / gist:5578023
Created May 14, 2013 17:54
Ruby day 3 code
rubycsv.txt
===
first, last, country
Yukihiro, Matsumoto, Japan
Bruce, Tate, USA
animals.txt
===
one, two
lions, tigers
@sleepyfox
sleepyfox / invisible-deficit.txt
Created July 31, 2013 11:40
Explanation of the invisible deficit
The term 'invisible deficit' comes from the introduction to Taylor's
"Principles of Scientific Management":
"We can see and feel the waste of material things. Awkward, inefficient, or
ill-directed movements of men, however, leave nothing visible or tangible
behind them. Their appreciation calls for an act of memory, an effort of the
imagination. And for this reason, even though our daily loss from this source
is greater than from our waste of material things, the one has stirred us
deeply, while the other has moved us but little."
@sleepyfox
sleepyfox / human-capabilities
Last active December 21, 2015 15:29
What should a human be able to do?
"A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet,
balance accounts, build a wall, set a bone, comfort the dying,
take orders, give orders, cooperate, act alone, solve equations,
analyze a new problem, pitch manure, program a computer, cook a tasty meal,
fight efficiently, die gallantly. Specialization is for insects."
-- Robert Heinlein, 'Time Enough for Love', 1973.
@sleepyfox
sleepyfox / tictactoe.pl
Created September 2, 2013 20:20
A board analyser for our 7 Languages in 7 Weeks Prolog session
%% A board is a list of states, each of which can be 'O', '' or 'X'
%% e.g. board('', '', '', '', '', '', '', '', '').
board('X', 'O', '', 'X', '', '', 'X', 'O', '').
row_one_win(X) :- board(X, X, X, _, _, _, _, _, _).
row_two_win(X) :- board(_, _, _, X, X, X, _, _, _).
row_three_win(X) :- board(_, _, _, _, _, _, X, X, X).
row_win(X) :- row_one_win(X) ; row_two_win(X) ; row_three_win(X).
@sleepyfox
sleepyfox / array-of-objects-intersection.coffee
Created December 15, 2013 12:15
Finding the intersection of two arrays of similar objects in CoffeeScript
# General pattern for intersection of two arrays of objects:
# collection1.filter collection2.indexOf
#
# Exercise for the reader: much optimisation can be done
myAlbums = [
{ id: 1, title: "The White Album" },
{ id: 2, title: "The Black Album" },
{ id: 3, title: "Hemispheres" },
{ id: 4, title: "Pure Heroine" } ]
@sleepyfox
sleepyfox / quantification.md
Last active January 4, 2016 00:39
A blog post on Measurement, quantification and violence (as in NVC)

Measurement, quantification and violence

Fox on Software, by @sleepyfox on 21 Jan 2014

Ah, now we see the violence inherent in the system
"Ah, now we see the violence inherent in the system!"

I hope that this provides the reader with some food for thought, and encourages your curiosity enough to ask some of the more challenging questions around metrics, measurement and quantification, both at work and in your broader life.

NVC, or Non-Violent Communication, is a way of communicating invented by Marshall Rosenburg as a way of facilitating and mediating between parties in conflict resolution scenarios between civil rights activists and the administration in 1960s America.

25 376200
25 318600
25 392400
20 226800
20 10800
20 72000
16 185400
16 194400
13 48600
13 75600
1 3600
1 5400
1 1800
1 3600
1 34200
1 10800
1 12600
1 17100
1 15300
1 72000