Skip to content

Instantly share code, notes, and snippets.

@maffoo
maffoo / amdahl.png
Last active August 29, 2015 14:21
Will it thread?
amdahl.png
@maffoo
maffoo / Timer.scala
Last active December 11, 2015 02:38 — forked from rkuhn/Timer.scala
/**
* Copyright (C) 2013 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.util
import java.util.concurrent.atomic.AtomicReferenceArray
import scala.annotation.tailrec
import scala.concurrent.ExecutionContext
@maffoo
maffoo / testjs-excerpt.py
Created August 20, 2012 23:52
Javascript Test Runner for JSTD + Sauce Connect + PhantomJS
with contextlib.nested(jstd, sauce):
with contextlib.nested(*browsers) as browsers:
print "capturing browsers..."
for browser in browsers:
if hasattr(browser, 'get'):
print "capturing browser {0}...".format(browser)
browser.get(jstd.capture_url)
print "running tests from {config}...".format(config=o.jstd_config)
jstd.run_tests(o.jstd_config, o.jstd_tests, o.jstd_output)
print "done with tests."
@maffoo
maffoo / testjs.py
Created August 20, 2012 21:44
Javascript Test Runner for JSTD + Sauce Connect + PhantomJS
import contextlib, optparse, os, subprocess, sys, tempfile, time
from selenium import webdriver
# sauce labs browser and os names
# see https://saucelabs.com/docs/ondemand/browsers
SAUCE_BROWSER = {
'chrome': webdriver.DesiredCapabilities.CHROME,
'firefox': webdriver.DesiredCapabilities.FIREFOX,
'ie': webdriver.DesiredCapabilities.INTERNETEXPLORER,
'opera': webdriver.DesiredCapabilities.OPERA
@maffoo
maffoo / matlab.py
Created August 6, 2012 14:36
Invoke matlab from python
import os
import subprocess
import tempfile
import numpy as np
def processMatrix(in_, funcStr):
"""Process the given matrix with MATLAB.
Uses temporary files to save the real and imaginary parts of the
@maffoo
maffoo / Build.scala
Created April 24, 2012 21:07
Ember template precompiler for play
import sbt._
import Keys._
import PlayProject._
object ApplicationBuild extends Build {
val emberOptions = SettingKey[Seq[String]]("ember-options")
val emberEntryPoints = SettingKey[PathFinder]("ember-entry-points")
def EmberCompiler(ember: String) = {
@maffoo
maffoo / wormhole_backend.js
Created April 13, 2012 16:31
wormhole - simple cross-domain ajax with a convenient interface
// backend
$(document).ready(function() {
// the server sets parentUrl in the page it serves, based on the http-referer
var windowProxy = new Porthole.WindowProxy(window.parentUrl + "/proxy.html");
function send(data) {
windowProxy.postMessage(JSON.stringify(data));
}
windowProxy.addEventListener(function(event) {
@maffoo
maffoo / ExpandAnimations.bas
Created May 18, 2011 00:19
Macro to expand animations in a LibreOffice/OpenOffice.org presentation into separate slides, suitable for pdf export.
' ExpandAnimations
' Copyright 2010 Matthew Neeley.
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
' This program is distributed in the hope that it will be useful,