Skip to content

Instantly share code, notes, and snippets.

View jdangerx's full-sized avatar
🐢
writing slow code slowly

Dazhong Xia jdangerx

🐢
writing slow code slowly
  • Catalyst Cooperative
  • Cambridge, MA
View GitHub Profile
(defun msm-list (sum ls)
(let* ((acc '())
(fakehash (make-array (+ 1 sum) :initial-element 0)))
(dolist (elt ls)
(incf (svref fakehash elt)))
(dolist (elt ls)
(let* ((comp (- sum elt))
(num-pairs (* (svref fakehash comp)
(svref fakehash elt))))
(if (= comp elt)
@jdangerx
jdangerx / oh_no
Last active December 15, 2015 09:59
PyNE build error
john@entropy:~/pyne$ rm -r build
john@entropy:~/pyne$ python setup.py install --user
-- HDF5_LIBRARY_DIRS = /usr/lib
-- PYTHON_EXECUTABLE: /usr/bin/python
-- Pyne platform defined as: __LINUX__
/ \
) (( )) (
(@) /|\ ))_(( /|\
|-| / | \ (/\|/\) / | \ (@)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jdangerx
jdangerx / filesize-vs-compression-level.py
Created October 24, 2012 22:24
filesize vs compression level for materials.write_hdf5
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rc('font', family='serif', size=16)
compressionlevel = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
filesize = np.array([504.3, 211.3, 210.4, 210.6, 209.1, 208.8, 208.5, 208.5, 208.2, 207.8])
fig = figure(figsize=(7,7))
plt.plot(compressionlevel, filesize, 'r-', figure=fig)