Skip to content

Instantly share code, notes, and snippets.

View derekbrokeit's full-sized avatar

Derek Ashley Thomas derekbrokeit

  • Moffett Field, CA
View GitHub Profile
@derekbrokeit
derekbrokeit / grepanki.sh
Created August 2, 2011 07:14 — forked from nicolas-raoul/grepdeck.sh
A script to grep through an Anki deck
#!/bin/sh
#
# Search for a term within an Anki deck.
#
# Usage: grepanki.sh someword
# run "grepanki" without any input for more detailed help
#
# You might want to add special aliases to the .bashrc or .bash_profile files
# alias gpj='grepanki' # searches defaultly
# alias gpr='grepanki -r' # searches the reverse direction
@derekbrokeit
derekbrokeit / asciidoc.vim
Created February 11, 2012 08:03 — forked from tpope/cucumbertables.vim
making sure that the behavior does not infiltrate other buffers (with different filetype) while in use; also changed to asciidoc
" added '<buffer>' to guard against this mapping from being used in other filetypes
inoremap <buffer><silent><Bar> <Bar><Esc>:call <SID>align()<CR>a
function! s:align()
let p = '^\s*|\s.*\s|\s*$'
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p)
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g'))
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*'))
Tabularize/|/l1
normal! 0
@derekbrokeit
derekbrokeit / imv.py
Created November 16, 2012 06:36
View images with the matplotlib library
#!/usr/bin/env python
# Use the power of matplotlib to display an image file
# This can be helpful when logged in to a remote server
# and you need more power than xview, or may xview hasn't
# been installed.
# 2012 Derek Ashley Thomas
import matplotlib as mpl
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
@derekbrokeit
derekbrokeit / pymol_setup_fix.diff
Last active October 13, 2015 22:48
Patch for pymol's `setup.py` script to be more accomodating to home-brew and non-macports users
--- setup.py 2012-12-12 22:55:39.000000000 +0900
+++ setup_fix.py 2012-12-12 23:04:19.000000000 +0900
@@ -153,10 +153,14 @@
outputheader.close()
outputfile.close()
- EXT = "/opt/local"
+ if os.path.isdir("opt/local"):
+ EXT = "/opt/local"
+ else:
@derekbrokeit
derekbrokeit / gist:4269280
Created December 12, 2012 16:29
patch for pymol pmg_tk to install on OSX with free glut
--- pymol/modules/pmg_tk/skins/normal/__init__.py 2012-12-13 01:19:10.000000000 +0900
+++ pymol_new/modules/pmg_tk/skins/normal/__init__.py 2012-12-13 01:15:42.000000000 +0900
@@ -250,7 +250,7 @@
self.buttonArea.destroy()
def my_show(self,win,center=1):
- if sys.platform!='linux2':
+ if (sys.platform!='linux2') and (sys.platform!='darwin'):
win.show()
else: # autocenter, deiconify, and run mainloop
@derekbrokeit
derekbrokeit / python_setup_NO_tkinter-framework.diff
Created December 17, 2012 03:21
Build Python without OSX Tkinter Framework auto detection
diff --git a/setup.py b/setup.py
index 6b47451..51cc779 100644
--- a/setup.py
+++ b/setup.py
@@ -1702,9 +1702,9 @@ class PyBuildExt(build_ext):
# AquaTk is a separate method. Only one Tkinter will be built on
# Darwin - either AquaTk, if it is found, or X11 based Tk.
platform = self.get_platform()
- if (platform == 'darwin' and
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
diff --git a/setup.py b/setup.py
index 6b47451..0bfca0c 100644
--- a/setup.py
+++ b/setup.py
@@ -620,7 +620,7 @@ class PyBuildExt(build_ext):
missing.extend(['imageop'])
# readline
- do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
+ do_readline = '/usr/local/opt/readline/lib/libhistory.dylib'
@derekbrokeit
derekbrokeit / build-fftw3-nec-sx.sh
Last active December 9, 2015 23:08
configure fftw on nec-sx platform ... why do you taunt me?! The diff file is here: https://gist.github.com/4341920 If the machine has a permission error, just move to the "builder" directory and run `make && make install` again ... and again ... and again .. until it finally works
#!/bin/sh
# fix the configure files
patch -p1 config.guess < fix-config-sx9.diff
# make the build directory
mkdir -p builder
cd builder
# configure
@derekbrokeit
derekbrokeit / fix-config-sx9.diff
Created December 20, 2012 00:06
Fix the configure scripts (config.guess and config.sub) to support NEC-SX9
diff --git a/config.guess b/config.guess
index d622a44..5dd0df7 100755
--- a/config.guess
+++ b/config.guess
@@ -1219,6 +1219,12 @@ EOF
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
+ SX-9:SUPER-UX:*:*)
+ echo sx9-nec-superux${UNAME_RELEASE}
@derekbrokeit
derekbrokeit / lammps_fftw-none.diff
Created December 20, 2012 08:10
build lammps with no fftw
diff --git a/src/MAKE/Makefile.mac b/src/MAKE/Makefile.mac
index ccefa59..42f5882 100755
--- a/src/MAKE/Makefile.mac
+++ b/src/MAKE/Makefile.mac
@@ -48,9 +48,9 @@ MPI_LIB = -lmpi_stubs
# PATH = path for FFT library
# LIB = name of FFT library
-FFT_INC = -DFFT_FFTW
+FFT_INC = -DFFT_NONE