This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends "layout.html" %} | |
{% block head %} | |
<style> | |
.btn-info { | |
margin-top: 5px; | |
} | |
#members { | |
display: none; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pip install -E ~/conf/virtualenvs/xyuml https://bitbucket.org/ericgazoni/openpyxl/get/1.5.8.zip |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' quick example showing how to attach a pdf to multipart messages | |
and then send them from SES via boto | |
''' | |
from email.mime.text import MIMEText | |
from email.mime.application import MIMEApplication | |
from email.mime.multipart import MIMEMultipart | |
import boto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BOL_adm3 = { | |
"type": "FeatureCollection", | |
"features": [{ | |
"type": "Feature", | |
"properties": { | |
"ID_0": 27, | |
"ISO": "BOL", | |
"NAME_0": "Bolivia", | |
"ID_1": 1, | |
"NAME_1": "Chuquisaca", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<h:html xmlns:h="http://www.w3.org/1999/xhtml" xmlns:orx="http://openrosa.org/jr/xforms" xmlns="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://openrosa.org/javarosa"> | |
<h:head> | |
<h:title>location location location</h:title> | |
<model> | |
<instance> | |
<data xmlns:jrm="http://dev.commcarehq.org/jr/xforms" xmlns="http://openrosa.org/formdesigner/4DCD3A18-692B-4BA4-BC5A-A863D1C766FA" uiVersion="1" version="1" name="location location location"> | |
<name /> | |
<province /> | |
<district /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' sp.py | |
throw data at a mongodb instance | |
simulate the SP data load | |
''' | |
import datetime | |
import os | |
from mongoengine import connect, Document, StringField, DateTimeField | |
connect('sp') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# commented version of a gist from @thenoviceoof | |
import os | |
import time | |
import random | |
# capture the screen size and find the middle-ish pixel | |
rows, columns = os.popen('stty size', 'r').read().split() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' classify | |
after training, classify a sample image with K-Nearest Neighbor | |
annotated from Abid Rahman's post: http://stackoverflow.com/a/9620295/232638 | |
''' | |
import cv2 | |
import numpy as np | |
# load the data we generated previously | |
samples = np.loadtxt('general-samples.data', np.float32) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' communicating to openbts through zeromq | |
''' | |
import json | |
import zmq | |
address = 'tcp://127.0.0.1:45060' | |
context = zmq.Context() | |
socket = context.socket(zmq.REQ) | |
socket.connect(address) | |
payload = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# via | |
# https://mail.python.org/pipermail/python-list/2010-August/586080.html | |
import random | |
import timeit | |
with open('/usr/share/dict/words') as infile: | |
words = [line.strip() for line in infile] | |
sample = random.sample(words, 501) |