Skip to content

Instantly share code, notes, and snippets.

View rwest's full-sized avatar

Richard West rwest

View GitHub Profile
- simple
- public over private
- personal vanity
- internet is global
- permalinks
- one important item per page
- don't break the browser
- don't wanker in technology
- a medium is not a grande
- break convention for your users
#!/usr/bin/env python
# encoding: utf-8
"""Extract cartesian geometries from gaussian log files using openbabel.
Reads all files that end '.log' in the current working directory.
Puts corresponding .mol files in the 'Geometries' subdirectory.
Created by Richard West on 2009-10-15.
Copyright (c) 2009 MIT. All rights reserved.
"""
@rwest
rwest / snippet.sc
Created November 5, 2009 19:25
turn list of InChIs into list of SMILES
import pybel
output = file('smiles.txt','w')
for inchi in file('inchis.txt'):
molecule = pybel.readstring("inchi",inchi)
output.write( molecule.write('smiles') )
@rwest
rwest / snippet.sc
Created November 17, 2009 19:38
Recursively search folders for '.log' files and scan them for a certain regular expression.
#! /usr/bin/env python
# Recursively search folders for '.log' files and scan them for a certain regular expression.
import re # regular expressions
import fileinput, sys, os
# precompile the search into a RegularExpression object to make it faster when we do it lots of times
searchExpression=re.compile("Sum\ of\ electronic\ and\ zero-point\ Energies=\s*([\-0-9.]+)")
def process_folder(folderpath):
#print "searching",folderpath
@rwest
rwest / snippet.txt
Created November 30, 2009 18:32
LaTeX for paragraph summaries
% for paragraph summaries
\newcommand{\parsum}[1]{
\marginpar{
\raggedright{}
\footnotesize{
{\sffamily \setlength{\baselineskip}{0.6\baselineskip}\textcolor{grey}{#1} \par}
}
}
}
@rwest
rwest / snippet.sc
Created February 16, 2010 14:22
put this in setup.py to avoid compiling ppc binaries
# Stop wasting my time compiling PowerPC-compatible C extensions on my intel Mac
import distutils.sysconfig
config = distutils.sysconfig.get_config_vars()
for key,value in config.iteritems():
location = str(value).find('-arch ppc')
if location>=0:
print "removing '-arch ppc' from %s"%(key)
config[key] = value.replace('-arch ppc ','')
# Tip from Lisandro Dalcin:
@rwest
rwest / .emacs
Created February 16, 2010 17:29
put this in .emacs to get backspace working
;; sort out backspace in .emacs on monch
(keyboard-translate ?\C-h ?\C-?)
(keyboard-translate ?\C-? ?\C-h)
(global-set-key "\C-h" 'delete-backward-char)
@rwest
rwest / snippet.sh
Created February 16, 2010 17:59
put this in .bash_profile to set up git variables
# set up git author details for commits and merges
export GIT_AUTHOR_NAME="Richard West"
export [email protected]
export GIT_COMMITTER_NAME="Richard West"
export [email protected]
# change the default editor from vi to emacs
export GIT_EDITOR=emacs # doesn't work with the old version of git on monch
export VISUAL=emacs # a more generic system-wide editor command that does the trick
TemperatureModel: Constant (K) 800 1000 1500
PressureModel: Constant (atm) 1 5 10
SpectroscopicDataEstimator: FrequencyGroups
PressureDependence: ReservoirState
PDepKineticsModel: Chebyshev
TRange: (K) 800 2000 7 4
PRange: (bar) 1 10 3 3
@rwest
rwest / chemkin.sh
Created March 11, 2010 20:58
chemkin
!#/bin/sh
echo "Which version of chemkin?"
echo " Chemkin Regular (21 seats)"
echo " Chemkin Pro (1 seat)"
OPTIONS="standard pro"
select opt in $OPTIONS; do
if [ "$opt" = "standard" ]; then
xterm -ls -title 'Chemkin Regular - do not close before chemkin!' -bg grey -e ksh "
source /home/reaction/chemkin15101_linuxx8664/bin/chemkin_setup.ksh
echo 'QUIT CHEMKIN BEFORE CLOSING THIS WINDOW OR YOU MAY NOT CHECK IN THE LICENCE';