This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""A module for various utilities and helper functions""" | |
import numpy as np | |
#cimport numpy as np | |
#cimport cython | |
DTYPEf = np.float64 | |
#ctypedef np.float64_t DTYPEf_t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Maximum rectangle algorithm | |
Main source: [1] | |
[1] http://stackoverflow.com/questions/8663079/maximum-rectangle-algorithm-implementation | |
""" | |
from collections import namedtuple | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
"""Non-interactive command line front end to NBody implementation""" | |
import time | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import itertools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Credits | |
------- | |
Stephane Raynaud | |
http://permalink.gmane.org/gmane.comp.python.matplotlib.general/24155 | |
""" | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import datetime as dtime | |
from matplotlib.dates import date2num |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CASE=$1 | |
DATA_ROOT=${DATA_ROOT:-$(pwd)} | |
RUNDIR="$DATA_ROOT/$CASE/run" | |
DOUT_S="TRUE" | |
DOUT_S_ROOT=${DOUT_S_ROOT:-"$DATA_ROOT/$CASE"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/env python | |
""" | |
This script can be executed as is or via an alias, e.g. | |
alias nclookipy='ipython -i ~/path/to/nclook.py' | |
to quickly open a NetCDF file in Python. | |
""" | |
import netCDF4 | |
import argparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def extract_email_addresses(adds): | |
adds = ''.join(adds.split()) | |
adds = re.sub(r'(\"|\,)', ' ', adds) | |
adds = re.split(r'\<(.*?\@.*?)\>', adds) | |
#adds = re.findall(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", ''.join(adds)) | |
adds = [a for a in adds if '@' in a] | |
return adds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
with open('cic.html', 'r') as f: | |
raw = f.read() | |
r = r"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?" | |
add = re.findall(r, raw) | |
unique = sorted(set(add)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
msls () { | |
rd=$1 | |
ssh_loc=$2 | |
scp_loc=$3 | |
if [ "${ssh_loc}" != "" ] && [ "${scp_loc}" != "" ]; then | |
ssh -q ${ssh_loc} "ssh -q ${scp_loc} ls -l ${rd}" | |
fi |
OlderNewer