Skip to content

Instantly share code, notes, and snippets.

View phaustin's full-sized avatar

Philip Austin phaustin

  • University of British Columbia
  • Vancouver, BC Canada
View GitHub Profile
@phaustin
phaustin / write_names.py
Last active August 29, 2015 14:15
json for config files
import io,json
from collections import OrderedDict as od
#need to add keys one at a time to preserve order
key_order=[('ticket_db','tickets_2014.db'),
('ticket_info','2013_ticket_charges.csv'),
('ticket_history','ticket_history2014.csv'),
('amor_corrections','amor_corrections.json'),
('student','students.json')]
@phaustin
phaustin / write_history.py
Last active August 29, 2015 14:15
logging
import logging
logging.basicConfig()
my_log=logging.getLogger('my_logger')
my_log.setLevel(logging.WARN)
my_log.propagate=True
my_log.propagate=False
try:
int('A')

rsync –progress –stats -az Users/phil/repos/eosc582 -e ssh owlhome:/home/phil/public_html/courses/eosc582/

rsync –progress –stats -az Users/phil/repos/e582_data -e ssh owlhome:/home/phil/public_html/courses/e582data/

rsync –progress –stats -az -e ssh rochome:/tera2/phil/tern/ data/phil/tern

rsync –progress –stats -az -e ssh newroc:/newtera/tera/phil/nchaparr/tera2_cp/nchaparr/ media/backups/phil/nchaparr

rsync –progress –stats -az /Applications/iclicker\ Mac\ -\ UBC\ -\ 6.4.2 -e ssh piphome:/home/phil/backups/iclicker

@phaustin
phaustin / dot_emacs.txt
Last active November 29, 2015 18:55
emacs
(load-file "~/elisp/misc/browse-yank.el")
(global-set-key (kbd "M-y") `browse-yank)
@phaustin
phaustin / csh2.txt
Created February 25, 2015 20:41
wget for laadsweb
/pip_raid/phil/sara phil@pip% wget -r --retr-symlinks ftp://ladsweb.nascom.nasa.gov/orders/500910416
@phaustin
phaustin / CMakeLists.txt
Last active August 29, 2015 14:16
cmake snippets
#
# two compiler specifications have to appear first
#
set(CMAKE_C_COMPILER /usr/local/bin/gcc-4.9)
set(CMAKE_CXX_COMPILER /usr/local/bin/g++-4.9)
cmake_minimum_required(VERSION 3.1)
project(temp)
set(CMAKE_Fortran_COMPILER gfortran)
enable_language(Fortran)
@phaustin
phaustin / docker.txt
Last active August 29, 2015 14:16
docker commands
#https://github.com/ContinuumIO/docker-images/tree/master/miniconda
docker pull continuumio/miniconda
docker run -i -t continuumio/miniconda /bin/bash
docker build -t phaustin/ssmi:v2 .
docker run -v /Users/phil/dockerfiles:/data -i -t phaustin/ssmi:v2 /bin/bash
docker pull phaustin/ssmi
docker run -v /Users/phil/dockerfiles:/data -i -t phaustin/ssmi /bin/bash --login
@phaustin
phaustin / write_data.py
Last active August 29, 2015 14:16
hdf5 creation with groups
with h5py.File(output_name, "w") as f:
comments=dict(lat='degrees lat (between -90 and 90)',
lon='degrees lon (betwen 0 and 360)')
for var in ['lat','lon']:
dset = f.create_dataset(var,bigdict[var].shape, dtype=bigdict[var].dtype)
dset[...]=bigdict[var][...]
dset.attrs['comment']=comments[var]
#
# write the 6 temperature arrays in two groups, one for each season
#
@phaustin
phaustin / ipython.txt
Last active January 16, 2016 02:54
ipython snippets
for i in *ipynb;do
ipython nbconvert --nbformat=4 --to=notebook --ClearOutputPreprocessor.enabled=True $i --out $i
done
* markdown from file
from IPython.display import Markdown
Markdown(filename='mdfile.md’)
@phaustin
phaustin / sublime_snippets
Last active August 29, 2015 14:17
sublime repl
preferences - package settings - sublime repl - user
{
"default_extend_env": {"PATH": "/home/phil/anaconda3/bin:{PATH}"}
}