Skip to content

Instantly share code, notes, and snippets.

View davidshepherd7's full-sized avatar

David Nikel-Shepherd davidshepherd7

View GitHub Profile
# Changes to defaults for "make"
# ============================================================
# How many cores do we have? Find out from /proc/cpuinfo (using regexp matching
# the start of info for a new processor).
NCORES=`grep --count '^processor[[:space:]]*:' /proc/cpuinfo`
# Apparently make runs fastest with one more job than there are cores.
NJOBS=$(($NCORES + 1))
export MAKEFLAGS="-j$NJOBS"
@davidshepherd7
davidshepherd7 / gist:4666285
Created January 29, 2013 18:12
example parallel parameter sweep for an oomph-lib driver
#!/usr/bin/env python
import subprocess as subp
from multiprocessing import Pool
import itertools
import sys
import numbers
import argparse
(define (q t) (abs (- t 5))
@davidshepherd7
davidshepherd7 / gist:4105231
Created November 18, 2012 13:21
1.31 Velocity Transformation
;; Just use the transformation from the example then pull out the velocity from the tuple.
(define (velocity-transform coordinate-transform)
(compose (lambda (tuple) (velocity tuple)) (F->C coordinate-transform)))
;; ;; Or explicitly using Gamma-bar this is:
;; (define (velocity-transform coordinate-transform)
;; (define (f-bar q-prime)
;; (define q (compose coordinate-transform (Gamma q-prime)))
;; (Gamma q))
;; (compose (lambda (x) (velocity x)) (Gamma-bar f-bar)))