Skip to content

Instantly share code, notes, and snippets.

View bpostlethwaite's full-sized avatar

Ben Postlethwaite bpostlethwaite

View GitHub Profile
InfiniteCheeseburger Spiral
http://8tracks.imgix.net/i/002/376/836/I-love-weed-infinite-cheeseburgers-8011.gif
Olive sleep walking
http://8tracks.imgix.net/i/002/376/853/I-love-weed-never-ending-sleep-walking-9251.gif
cellular bio-thing
http://8tracks.imgix.net/i/002/347/582/giphy-1174.gif
awesome pyramid brain rail
http://8tracks.imgix.net/i/001/999/892/tumblr_n3jzcmLUuD1tn7hmso1_500-1226.gif
Infinite Oceans
http://8tracks.imgix.net/i/002/376/856/I-love-weed-symmetrical-oceans-1551.gif
@bpostlethwaite
bpostlethwaite / extract8TracksGIFs
Created July 25, 2014 15:27
extract all the gif img tags from 8tracks
var tmp = $('<div></div>')
$('body').prepend(tmp)
tmp.css('height', 400)
tmp.css('width', 900)
tmp.css('overflow', 'scroll')
a = $('#feed-container').find('li')
for (var i = 0; i < a.length; i++) {
thingy = function () {
this.model = new Float32Array([
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
]);
}
proto.onRender = function () {
// for units that are owned by a particular player
function clientEmitter (game, unitId, clientId) {
var ev = new EventEmitter()
var cachedEmit = ev.emit
// we need to override the event emitters emit function to put our own juice in there
ev.emit = function (msg, data) {
function randIntGenerator(min, max) {
if (!min) min = 50
if (!max) max = 250
return function () {
return Math.floor(Math.random() * (max - min + 1)) + min
}
}
// this creates a function that outputs a random integer in the specified range
randGrid = randIntGenerator(0,22)

monitoring shit with monit

get monit

sudo apt-get install monit

monit configuration is in ~/.monitrc

@bpostlethwaite
bpostlethwaite / sinbox.js
Created April 7, 2014 19:03
emitter that emits modified sine waves
var EventEmitter = require('events').EventEmitter
var sinner = SinBox()
setInterval( function () {
sinner.setAmplitude(12)
}, 500)
setInterval( function () {
sinner.setFrequency(40)
}, 500)
{
"metadata": {
"language": "Julia",
"name": "Julia Benchmark Plotly Barchart"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
import numpy as np
import plotly
py = plotly.plotly(username='bpostlethwaite', key='xxxxxxxxxx')
numletters = 5
letterblock = 100.
pad = 10.
@bpostlethwaite
bpostlethwaite / ForwardMag.m
Created August 2, 2013 17:50
Attempt 1 at replicated Forward Mag Operator
%% Geometry
nx = 9;
ny = nx;
nz = nx-1;
% Set up graded mesh
curve = 0;
weight = 0.61; % Percent finer mesh at finest scale to coarsest.
gmesh = meshfunc(curve, weight);