Skip to content

Instantly share code, notes, and snippets.

View olivierverdier's full-sized avatar

Olivier Verdier olivierverdier

View GitHub Profile
@olivierverdier
olivierverdier / gist:662378
Created November 4, 2010 12:18
calc_pep_index in Python
def calc_pep_index(A,E):
R = E
for i in xrange(1000):
R1 = .975*(A*R)+.025*E
if norm(R1-R) < some_tolerance:
break
R = R1
else:
raise Exception("no convergence")
return R
@olivierverdier
olivierverdier / gist:663898
Created November 5, 2010 09:49
how to create a film from a repo using gource on Mac OS X
gource --stop-at-end --output-ppm-stream - $GIT_REPO | ffmpeg2 -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec mpeg4 $FILM_NAME.mp4
@olivierverdier
olivierverdier / gist:663902
Created November 5, 2010 09:53
Create a new repo containing only one file
# remove all the files but the file named "my_file.py":
git filter-branch -f --prune-empty --tree-filter 'find . ! -type d | grep -v "./my_file.py$" | while read FILE; do rm "$FILE"; done' HEAD
# if there are still empty commit despite the --prune-empty option, remove them:
git filter-branch --commit-filter 'if [ z$1 = z`git rev-parse $3^{tree}` ]; then skip_commit "$@"; else git commit-tree "$@"; fi' "$@"
@olivierverdier
olivierverdier / gist:918044
Created April 13, 2011 18:07
super(explicitclass,self) vs super(self.__class__,self)
class A(object):
def msg(self):
print 'A',
class B(A):
def msg(self):
super(B,self).msg()
print 'B',
class C(B):
@olivierverdier
olivierverdier / gist:5125395
Last active December 14, 2015 17:49
This is an illustration of how the numerical integrator Shake and Rattle work on a simple planar pendulum example. The way it works is by kicking the mass upwards, releasing the constraint, let the mass fly and land back on the constrained set. The drawing is geometrically correct. For more details on those methods, see http://arxiv.org/abs/1207…
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings,intersections,fpu}
\tikzset{
>=stealth,
fiber/.style={draw,thick,blue!70!black},
flight/.style={draw,black,thick, densely dotted, decoration={markings, mark=at position 0.6 with {\arrow{>}}}, postaction={decorate}},
@olivierverdier
olivierverdier / gist:6724986
Last active March 28, 2024 15:10
Battles Trefethen Ipython notebook
This file has been truncated, but you can view the full file.
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Chebfun in Python"
]
},
{
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.