Skip to content

Instantly share code, notes, and snippets.


Dominique dpo

View GitHub Profile
dpo /
Created Nov 8, 2010
Comment out declaration of ETIME as EXTERNAL in Fortran files.
# etime intrinsic cannot be declared as EXTERNAL with gfortran on OSX.
files_with_etime=`find . -name "*.[fF]" | xargs grep -l -i 'etime'`
for fname in $files_with_etime
mv $fname ${fname}.backup
sed -e 's/^ \(EXTERNAL[ ]*ETIME.*\)/C \1/' ${fname}.backup > $fname
rm ${fname}.backup
dpo / Auto-profiling in Python
Created Dec 5, 2010
Create a pdf with profile information in the form of a directed graph. Requires graphviz and
View Auto-profiling in Python
python -m cProfile -o ${outfile}.pstats $@
if [[ $? ]]; then -f pstats ${outfile}.pstats | dot -Tpdf -o ${outfile}.png
echo "Profile graph is in ${outfile}.png"
echo "Profile creation aborted."
dpo / amplog
Created Sep 3, 2011
Simple AMPL Decoding
View amplog
# This script helps save keystrokes when decoding AMPL models.
# "amplog name.mod" means "ampl -ogname name.mod"
# "amplog name2 name.mod" means "ampl -ogname2 name.mod"
# "amplog name2 name.mod name.dat" means "ampl -ogname2 name.mod name.dat"
if (( $# == 1 )); then
dpo /
Created Sep 16, 2011
Memoization of functions and methods with sha1 digest of numpy arrays.
import numpy as np
import functools
import hashlib
class Memoized(object):
Decorator class used to cache the most recent value of a function or method
based on the signature of its arguments. If any single argument changes,
the function or method is evaluated afresh.
dpo / vim.rb
Created Mar 9, 2012
Homebrew formula to build vim against Homebrew Python 2.7.3 with client/server feature
View vim.rb
# Install with --without-ruby if you observe segfaults.
require 'formula'
class Vim < Formula
homepage ''
# Get the base 7.4 tarball from But once patches start again, go
# back to tracking Debian unstable here:
url ''
View asl.rb
require 'formula'
class ASLDownloadStrategy < NoUnzipCurlDownloadStrategy
def _fetch
# The Netlib FTP server is picky about the password
# used for anonymous access; an @-terminated string isn't enough.
curl '-u', '', @url,
'--output', @tarball_path
dpo / BibTeX.sublime-build
Last active Mar 2, 2020
Sublime build definition to clean up auxiliary LaTeX files. CleanLatexFiles.sublime-build is taken from Other files are adapted from various sources. Place all files in Packages/User/
View BibTeX.sublime-build
"cmd": ["bibtex", "$project_path/$project_base_name"],
"working_dir": "$project_path",
"path": "$PATH:/usr/texbin:/usr/local/bin",
"file_regex": "^(...*?):([0-9]+): ([0-9]*)([^\\.]+)",
"selector": "text.tex.latex"
View pkrylov.log
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012) (format=pdflatex 2012.6.30) 15 FEB 2013 11:50
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2012-05-30, ngerman-x-2012-05-30, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
dpo / mail2things.scpt
Last active Dec 13, 2015
An Automator workflow to add an email from to Things' Inbox. This is a modification of Create an Automator Service, start with "Get Selected Mail Messages", then "Run AppleScript" and paste the contents of this gist as script. Subsequently, you can process the list of new todo items. I lik…
View mail2things.scpt
on run {input, parameters}
set todoList to {}
repeat with theMessage in input
-- Grab message info.
tell application "Mail"
-- Remove apostrophes from Subject as they wreak havoc.
set AppleScript's text item delimiters to {"'"}
tmpfile=`mktemp -t scalapack`
(( $# > 0 )) && execs="$@" || execs=`find . -type f -perm +111`
fmt='%12s %4s %4s\n'
printf "$fmt" "test" "fail" "skip"
for exec in ${execs[@]}
mpirun -np ${np} ${exec} > $tmpfile 2>&1