Skip to content

Instantly share code, notes, and snippets.

View josephtate's full-sized avatar

Joseph S. Tate josephtate

  • Pale Mountain
  • Durham, NC
View GitHub Profile
@josephtate
josephtate / unittest.py
Last active April 22, 2020 19:24
A beginning framework to unit test CherryPy handlers and tools
import cherrypy
from cStringIO import StringIO
import logging
import os
import pytest
import json
from mock import Mock
URL_PREFIX = "/api"
@josephtate
josephtate / Readme.md
Last active January 31, 2019 00:56
Programming Merit Badge Notes
@josephtate
josephtate / unit-conversion.ipynb
Last active October 27, 2018 07:12
Jupyter Notebook for Programming Merit Badge
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
- name: ubuntu ssh keys
include: ssh.yml ssh_user=ubuntu
#locale needed as of 2013/12/17
- name: Install python-software-properties and locale
apt: state=present pkg=python-software-properties,language-pack-en update_cache=yes
tags: deploy
- name: Enable crunch.io ppa
apt_repository: state={{'present' if ansible_distribution_release=='precise' else 'absent'}} repo="ppa:crunch.io/public-{{ppa_repo}}"
FROM ubuntu/precise
MAINTAINER Crunch.io <systems@crunch.io>
# This is a starting point. We may want to build these images using ansible instead of
# Dockerfile
RUN apt-get install -y libatlas3gf-base liblz4-tool python-software-properties language-pack-en
RUN easy_install -U -i http://<pypicreds>@pypi.crunch.io/pypi/stable/ -Z zz9d zz9lib numpy
#Web role handlers
- name: start nginx
service: state=started name=nginx
- name: restart nginx
service: state=restarted name=nginx
- name: check webapp
wait_for_cmd: shell='curl -s -o /dev/null -k -w "%{http_code}" {{local_webapp_url}} | grep 401' delay=15 timeout=60 repeat_delay=3
@josephtate
josephtate / age.py
Created January 26, 2013 08:17
An age calculating library
import datetime
import calendar
def simple_age(birthdate, today=None):
if today is None:
today = datetime.date.today()
#what's this year's birthdate?
try:
bd = datetime.date(today.year, birthdate.month, birthdate.day)
except ValueError: