Skip to content

Instantly share code, notes, and snippets.

Dave Evans evansde77

  • Aurora, IL
Block or report user

Report or block evansde77

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@evansde77
evansde77 / setup.sh
Last active Dec 5, 2016
Python Environment Setup on MacOSX
View setup.sh
#!/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 / install_pillow.sh
Created Jun 8, 2016
Steps to install libjpeg and pillow on Max OSX 10.11.15 (assumes XCode, XCode command line tools etc)
View install_pillow.sh
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 / word_count_histogram.py
Last active Jun 1, 2016
Playing around with an ascii histogram example
View word_count_histogram.py
#!/usr/bin/env python
"""
Example wordcount and ascii histogram script
- Writes a data file in a temporary dir
- defines function to parse file into a word iterable
- Histogram class that does the word count and draws it as
ascii strings with various sorting options
Example usage:
@evansde77
evansde77 / pyfile_to_module.py
Last active May 26, 2016
Util to convert filenames to python module names as a command line tool
View pyfile_to_module.py
#!/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
View API endpoint docstring
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 / pythonic_config.py
Created Feb 12, 2016
Example of wrapping a nested JSON config object in a simple python object that allows dynamic object.attr style access to the data elements
View pythonic_config.py
#!/usr/bin/env python
"""
example of using a simple python object to wrap a JSON
configuration mapping so that it can be accessed as
a python style object using conf.attr1.attr2.value
"""
CONF = {
"CREDENTIALS": {
View provision.log
==> derp: Loading Berkshelf datafile...
==> derp: Sharing cookbooks with VM
==> derp: Updating Vagrant's Berkshelf...
==> derp: Resolving cookbook dependencies...
==> derp: Fetching 'derp' from source at .
==> derp: Fetching 'docker' from source at docker
==> derp: Using apt (2.9.2)
==> derp: Using build-essential (2.2.4)
==> derp: Using chef-sugar (3.3.0)
==> derp: Using compat_resource (12.5.26)
@evansde77
evansde77 / Vagrantfile
Last active Jan 29, 2016
Details for reproducing error in docker cookbook dependency under Vagrant/Chef-solo
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
Vagrant.require_version '>= 1.5.0'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
View ex_test.py
class MyTest(unittest.TestCase):
harness, setUp, tearDown = make_database_test_harness(**args)
def test_a_thing(self):
print self.harness
View log_watch.sh
function carb_logs(){
CLUSTER=$1
knife ssh -x evansde77 role:load_balancer_${CLUSTER} "tail -f /opt/sapi/logs/carburetor_package.log" -a ip.public
}
You can’t perform that action at this time.