Skip to content

Instantly share code, notes, and snippets.

View alex-hofsteede's full-sized avatar

Alex Hofsteede alex-hofsteede

View GitHub Profile
#!/usr/bin/python
import subprocess
import sys
"""
Used in a tmux session, connects a synchronized interactive ssh session to all
hostnames read from stdin (1 per line). Preserves all ssh arguments.
Example usage:
tmux
(define (unit-valid unit)
(equal? (sort unit <) (list '1 '2 '3 '4 '5 '6 '7 '8 '9)))
(define (units-valid func lst n)
(if (eqv? n 8)
(unit-valid (func lst n 0))
(and (units-valid func lst (+ n 1)) (unit-valid (func lst n 0)))))
(define (nth-row lst n i)
(let ((cell (list (list-ref lst (+ (* n 9) i)))))
#!/usr/bin/python
import subprocess
import sys
"""
Used in a tmux session, connects a synchronized interactive ssh session to all
hostnames read from stdin (1 per line). Preserves all ssh arguments.
Example usage:
tmux
#!/usr/bin/python
import subprocess
import sys
"""
Used in a tmux session, connects a synchronized interactive ssh session to all
hostnames read from stdin (1 per line). Preserves all ssh arguments.
Example usage:
tmux
var eventSelect = d3.select("body").append("select").attr("name", "event").attr("onchange", "window.selectedEvent = this.value; window.getProperties()");
var prop1Select = d3.select("body").append("select").attr("name", "prop1").attr("onchange", "window.property1 = this.value; window.query()");
var prop2Select = d3.select("body").append("select").attr("name", "prop2").attr("onchange", "window.property2 = this.value; window.query()");
window.selectedEvent = 'Viewed report';
window.property1 = '$os';
window.property2 = 'mp_country_code';
MPAPI.top_events().done(function (results) {
@alex-hofsteede
alex-hofsteede / sparkline.html
Created January 13, 2015 19:54
Simple Sparkline
<html>
<head>
<style>
path.sparkfill {
fill:#c0d0f0;
}
path.sparkstroke {
stroke:#0000f0;
stroke-width:1px;
fill:none;
#!/usr/bin/python
import datetime
import json
import os
import subprocess
import urllib2
"""
Sets your mac desktop background to be a recent picture of the earth from space
"""
@alex-hofsteede
alex-hofsteede / fincore.c
Last active June 4, 2016 16:04
The simplest possible utility to determine how many pages of a file are in the page cache
#define _BSD_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <stdint.h>
#include <unistd.h>
/*
A B C 1 2 3
Z Y X 1 2 3
@alex-hofsteede
alex-hofsteede / -
Last active March 11, 2016 22:44
1984 BBC PRESTEL logo
python -c 'print "\n".join(["P R E S T E L"[:13-abs(x)].rjust(13-abs(x)/2) for x in range(-12,13,4)])'