Skip to content

Instantly share code, notes, and snippets.

View rmcgibbo's full-sized avatar

Robert T. McGibbon rmcgibbo

View GitHub Profile
@rmcgibbo
rmcgibbo / free-slots.py
Created September 24, 2014 21:03
Summarize free slots on PBS queues [script]
#!/usr/bin/python
from __future__ import division, print_function
import subprocess
import xml.etree.ElementTree as ET
from collections import defaultdict, namedtuple
status = namedtuple('status', ['properties', 'np_alloc', 'np_total'])
def collect():
xmldata = subprocess.Popen(['/usr/bin/pbsnodes', '-x'], stdout=subprocess.PIPE).communicate()[0]
root = ET.fromstring(xmldata)
@rmcgibbo
rmcgibbo / free-slots.py
Last active August 29, 2015 14:07
Summarize free slots on SGE [script]
#!/usr/bin/python
import subprocess
from collections import defaultdict
from collections import namedtuple
from distutils.spawn import find_executable
import xml.etree.ElementTree as ET
status = namedtuple('status', ['queue', 'np_alloc', 'np_total'])
QHOST_BIN = find_executable('qhost')
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rmcgibbo
rmcgibbo / fft_padding.py
Last active August 29, 2015 14:12
Speed of FFT with and without padding
import time
import numpy as np
from pyhmc.fftutils import next_fast_fft
ns = np.linspace(2, 20000).astype(np.int)
t1, t2 = [], []
for n in ns:
x = np.random.randn(n)
start = time.clock()
f = np.fft.fft(x)
@rmcgibbo
rmcgibbo / time.ino
Created January 27, 2015 07:18
Macro to set the time on an ardunio using https://github.com/PaulStoffregen/Time from the __DATE__ and __TIME__ preprocessor macros.
#define SET_TIME() (setTime( \
((__TIME__[0]-'0')*10 + (__TIME__[1]-'0')), \
((__TIME__[3]-'0')*10 + (__TIME__[4]-'0')), \
((__TIME__[6]-'0')*10 + (__TIME__[7]-'0')), \
((__DATE__[4]-'0')*10 + (__DATE__[5]-'0')), \
(__DATE__ [2] == 'n' ? (__DATE__ [1] == 'a' ? 1 : 6) \
: __DATE__ [2] == 'b' ? 2 \
: __DATE__ [2] == 'r' ? (__DATE__ [0] == 'M' ? 3 : 4) \
: __DATE__ [2] == 'y' ? 5 \
: __DATE__ [2] == 'l' ? 7 \
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
$ doccheck numpy
Could not locate executable icc
Could not locate executable ecc
can cast
X ? b h i l q p B H I L Q P e f d g F D G S U V O M m
? 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1
b 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1
h 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1
i 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 0 1
l 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 1 0 1 1 1 1 1 1 0 1
$ doccheck scipy
scipy.cluster.hierarchy:cophenet ( /home/rmcgibbo/projects/scipy/scipy/cluster/hierarchy.py )
Parameter is optional: Y
scipy.cluster.hierarchy:dendrogram ( /home/rmcgibbo/projects/scipy/scipy/cluster/hierarchy.py )
Undocumented arguments: {'no_leaves', 'color_list'}
scipy.cluster.hierarchy:pre_order ( /home/rmcgibbo/projects/scipy/scipy/cluster/hierarchy.py )
Parameter is optional: func
$ cat test1.py
import gzip
from rdkit import Chem
mol = Chem.MolFromSmiles('CC(=O)OC1=CC=CC=C1C(=O)O')
f = gzip.open('out', 'w')
w = Chem.SDWriter(f)
w.write(mol)
w.flush()
f.close()
*DECK EXPREL
FUNCTION EXPREL (X)
C***BEGIN PROLOGUE EXPREL
C***PURPOSE Calculate the relative error exponential (EXP(X)-1)/X.
C***LIBRARY SLATEC (FNLIB)
C***CATEGORY C4B
C***TYPE SINGLE PRECISION (EXPREL-S, DEXPRL-D, CEXPRL-C)
C***KEYWORDS ELEMENTARY FUNCTIONS, EXPONENTIAL, FIRST ORDER, FNLIB
C***AUTHOR Fullerton, W., (LANL)
C***DESCRIPTION