Skip to content

Instantly share code, notes, and snippets.

View lukeorland's full-sized avatar

Luke Orland lukeorland

View GitHub Profile
function split_novowel {
echo $1 | cut -d_ -f$2 | sed 's/[aeiou]//g'
}
function abbr {
echo $(split_novowel $1 1 | cut -c 1-3)$(split_novowel $1 2 | cut -c 1-1)
}
abbr Computer_Hardware
$ python manage.py shell
/Users/orluke/src/neo4django-tutorial/venv/src/neo4django/neo4django/db/models/relationships.py:170: UserWarning: `lazycat_set` and `lazycat_set` share a relationship type and direction. Is this what you meant to do?
% (r.name, name))
Python 2.7.3 (default, Feb 6 2013, 23:59:57)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.24)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from polls.models import Poll, Choice
/Users/orluke/src/neo4django-tutorial/venv/src/neo4django/neo4django/db/models/relationships.py:170: UserWarning: `choices` and `choices` share a relationship type and direction. Is this what you meant to do?
% (r.name, name))
@lukeorland
lukeorland / nltk_english_sentence_splitter.py
Last active December 19, 2015 01:29
This script reads in lines of UTF-8 text from stdin, applies the NLTK English sentence tokenizer to the text, and prints out the split lines to stdout, preserving runs of two or more newline characters. N.B. An assumption being made is that the NLTK English Punkt model is already installed in an appropriate location in the environment.
#!/usr/bin/env python
"""
This script reads in lines of UTF-8 text from stdin,
applies the NLTK English sentence tokenizer to the text, and
prints out the split lines to stdout (in UTF-8), preserving runs of two or more
newline characters.
N.B. An assumption being made is that the NLTK English Punkt model is already
installed in an appropriate location in the environment.
"""
# std
import io
import time
# vendor
import serial
ser = serial.Serial('/dev/tty.usbserial-A6008sxN', 115200, timeout=1)
time.sleep(2)
import time
from nose2.tools import such
def slow_blocking_init():
time.sleep(1)
print("a second elapsed")
time.sleep(1)
print("a second elapsed")
return True
@lukeorland
lukeorland / test_nose2_unittest_layers.py
Last active August 29, 2015 14:04
When I was looking into this issue: https://github.com/nose-devs/nose2/issues/215 I discovered some naming/behavior inconsistency between the "classmethod setUp", "setUp", and "classmethod setUpClass"
"""
run with:
nose2 test_nose2_unittest_layers --plugin nose2.plugins.layers --layer-reporter --verbose
"""
import time
import unittest
class Layer1(object):
#!/bin/bash
#---------------------------------------#
# Python 2.7.3 Install on CentOS 5 #
# https://gist.github.com/timss/5122008 #
# #
# Installs to /usr/local/{bin,lib} #
# Seperate from system default #
# /usr/bin/python(2.4) #
#---------------------------------------#
2014-11-01 19:22:54,843 INFO
VmPool.py._recycle_next: 85
VmPool Recycle Queue: creating instance 1
2014-11-01 19:22:54,844 INFO
VmPool.py._create: 319
VmPool: creating instance 1: engaging VmMaster.lock()
2014-11-01 19:22:54,846 INFO
VmInstance.py.create: 225
2014-11-01 19:23:01.167+0000: starting up
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin QEMU_AUDIO_DRV=none /usr/libexec/qemu-kvm -name instance1.0-1 -S -M rhel6.6.0 -cpu SandyBridge,+invtsc,+erms,+smep,+fsgsbase,+pdpe1gb,+rdrand,+f16c,+osxsave,+dca,+pcid,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -enable-kvm -m 2048 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 971806c0-63ed-8dc3-ce07-25788aaaedbe -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/instance1.0-1.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -no-shutdown -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x7.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0
lorland at Lukes-Neverware-mba in ~/workspace/peptalk (symlink-hardcoded-Juicebox-code-path●)
$ time ansible-playbook -i hosts site.yml -l rc_fresh1 -vvvv
PLAY [Configure and deploy the CentOS 6.5 Juiceboxes and application code] ****
GATHERING FACTS ***************************************************************
<172.16.29.89> ESTABLISH CONNECTION FOR USER: root
<172.16.29.89> REMOTE_MODULE setup
<172.16.29.89> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/Users/lorland/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=root', '-o', 'ConnectTimeout=10', '172.16.29.89', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1414864230.27-222877363691008 && echo $HOME/.ansible/tmp/ansible-tmp-1414864230.27-222877363691008'"]
<172.16.29.89> PUT /var/folders/7l/7lc870xx2wn_m2pv29mg9d100000gn/T/tm