Skip to content

Instantly share code, notes, and snippets.

View evansde77's full-sized avatar

Dave Evans evansde77

View GitHub Profile
def post(self):
"""
Create a new user document in the users and cluster users database.
:json string username: required, the requested username
:json string password: required, the requested password
:json string email: required, and email address to be associated
with the account
:json string first_name: required, the user's first name
:json string last_name: required, the user's last name
:json string company: optional, the user's company
@evansde77
evansde77 / pyfile_to_module.py
Last active May 26, 2016 18:11
Util to convert filenames to python module names as a command line tool
#!/usr/bin/env python
"""
pyfile_to_module
Simple util to convert a python filename like
some_package/some_module/some_file.py to some_package.some_module.some_file
style module name.
"""
import argparse
@evansde77
evansde77 / install_pillow.sh
Created June 8, 2016 15:40
Steps to install libjpeg and pillow on Max OSX 10.11.15 (assumes XCode, XCode command line tools etc)
sudo chmod -R a+rw /usr/local/src
mkdir /usr/local/src
chmod a+rw -R /usr/local/src
curl --remote-name http://www.ijg.org/files/jpegsrc.v9b.tar.gz
tar -xzvf jpegsrc.v9b.tar.gz
cd jpeg-9b
./configure --enable-shared --enable-static
make
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a
@evansde77
evansde77 / setup.sh
Last active December 5, 2016 23:19
Python Environment Setup on MacOSX
#!/bin/bash
# assumes that XCode and XCode command line tools have been installed
# xcode-select --install
# assumes that gfortran has been installed
# https://gcc.gnu.org/wiki/GFortranBinaries
# install pyenv & set 2.7.11 as current
# See: https://github.com/yyuu/pyenv-installer
# See: https://github.com/yyuu/pyenv
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
@evansde77
evansde77 / git_branch_prompt.sh
Last active March 20, 2019 18:08
Example bash command to show current branch in shell prompt that can be added to bashrc/bash_profile
function parse_git_branch ()
{
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
BRANCH="("${ref#refs/heads/}")";
echo "${BRANCH}"
}
export PS1="[\t \W] \$(parse_git_branch) "
@evansde77
evansde77 / mac_install_hdfs3.sh
Created July 5, 2017 21:15
Installation steps to install hdfs3 and underlying libhdfs3 on a Mac
#
# required downloading source of cmakem protobuf, gsasl as well as hdfs3
#
mv ~/Downloads/cmake-3.9.0-rc5.tar.gz .
tar -zxf cmake-3.9.0-rc5.tar.gz
cd cmake-3.9.0-rc5
./bootstrap && make
sudo make install
from contextlib import contextmanager
@contextmanager
def context1(arg):
print("Bronte")
yield "Tolkien"
print(arg)
(base) root@0343625ee20e:/opt/unicron/imc-unicron-jupyter# conda list
# packages in environment at /opt/conda:
#
# Name Version Build Channel
_libgcc_mutex 0.1 main
asn1crypto 1.0.1 py37_0
attrs 19.2.0 py_0
backcall 0.1.0 py37_0
bleach 3.1.0 py37_0
ca-certificates 2019.8.28 0