This file contains 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
/* Teensy LC sketch for controlling a stepper motor. | |
Reads comma-separate commands over serial. Sends back number of steps taken. | |
Commands are of the form: | |
step,300,800 -> stepper should move 300 sixteenth-steps forward at 800 steps per second | |
step,-124,100 -> stepper should move 124 sixteenth-steps backward at 100 steps per second | |
*/ |
This file contains 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 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
$ ssh-keygen -l -f /path/to/keys/id_rsa.pub | |
2048 aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99 id_rsa.pub (RSA) |
This file contains 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 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
class EventTable(tables.Table): | |
def __init__(self, *args, **kwargs): | |
# Pop out the date_header named arg before calling super. | |
date_header = kwargs.pop('date_header', 'Date') | |
super(EventTable, self).__init__(*args, **kwargs) | |
self.base_columns['date'].verbose_name = date_header | |
class Meta: | |
model = models.Event | |
fields = ('date', 'value') |
This file contains 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 | |
''' | |
testing a login to meduele using sessions | |
meduele checks csrf tokens with every request, even during login | |
''' | |
import requests | |
from BeautifulSoup import BeautifulSoup | |
# need to capture a valid csrf token | |
# first visit the login page to generate one |
This file contains 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 | |
''' | |
ncdc_processor.py | |
imports a csv of historical weather data from the NCDC | |
exports a somewhat more sanely formatted csv suitable for graphing | |
data from http://www7.ncdc.noaa.gov/CDO/cdo | |
usage: | |
$ python ncdc_processor.py /path/to/ncdc_data.txt /path/to/export.csv |
This file contains 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
"""Order a queryset by last_active and make null values sort last.""" | |
import datetime | |
from django.db.models.functions import Coalesce | |
from app import models | |
# Coalesce works by taking the first non-null value. So we give it |
This file contains 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/python | |
# -*- coding: utf-8 -*- | |
import Queue | |
import threading | |
import urllib2 | |
import time | |
hosts = ['http://yahoo.com', 'http://google.com', 'http://amazon.com', | |
'http://ibm.com', 'http://apple.com'] |
This file contains 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
"""XLS -> json converter | |
first: | |
$ pip install xlrd | |
then: | |
$ cat in.xls | |
date, temp, pressure | |
Jan 1, 73, 455 | |
Jan 3, 72, 344 |
NewerOlder