This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import sys | |
import os | |
def ssh_copy_id(host='localhost', ssh='ssh', keyfile='~/id_rsa.pub', sshopts=()): | |
opts = ' '.join('-o ' + opt for opt in sshopts ) | |
cmd = 'cat %(keyfile)s | %(ssh)s %(opts)s %(host)s \'umask 077; mkdir -p .ssh; cat >> .ssh/authorized_keys\'' | |
os.system(cmd % locals()) | |
if __name__ == "__main__": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from clang.cindex import * | |
def is_function_call(funcdecl, c): | |
""" Determine where a call-expression cursor refers to a particular function declaration | |
""" | |
defn = c.get_definition() | |
return (defn is not None) and (defn == funcdecl) | |
def fully_qualified(c): | |
""" Retrieve a fully qualified function name (with namespaces) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scommon | |
scommon.sconscript_validator(Environment) | |
menv = Environment() | |
menv.SConscript('SConscript', exports=['menv']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# IPython notebook build process for Ubuntu 12.04 from pypi | |
# | |
# This is probably very far from good practice for docker, but it's a demonstration | |
# of how to get very precise control of an environment that suitable for testing | |
# | |
# docker build -t ipynb . | |
# docker run -t -i -p 127.0.0.1:8888:8888 ipynb | |
FROM ubuntu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on "Approximate Inversion of the Laplace Transform" by Cheng and Sidauruk, | |
# in the Mathematica Journal, vol 4, issue 2, 1994 | |
import scipy.misc | |
fact = scipy.misc.factorial | |
def csteh(n, i): | |
acc = 0.0 | |
for k in xrange(int(np.floor((i+1)/2.0)), int(min(i, n/2.0))+1): | |
num = k**(n/2.0) * fact(2 * k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a python port of the minimum time solution of the double integrator | |
# (with no damping) minimum time value iteration problem, based on the course notes of | |
# MIT OCWs Underactuated robotics. | |
# | |
# The original material that this work is derived from is: | |
# | |
# Prof. Russel Tedrake, Underactuated Robotics, Spring 2009. (Massachusetts Institute of # Technology: MIT OpenCouseWare), http://ocw.mit.edu (Accessed May 2012). License: | |
# Creative Commons BY-NC-SA | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.integrate import odeint | |
import glob | |
import os | |
def simple_pendulum_deriv(x, t, m, g, l): | |
"""The simple pendulum subject to zero damping and zero control input | |
Based on material from the MIT OCW subject "Underactuated Robotics" |