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
// the pins for each connector on the el escudo | |
#define A 2 | |
#define B 3 | |
#define C 4 | |
#define D 5 | |
#define E 6 | |
#define F 7 | |
#define G 8 | |
#define H 9 |
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
""" | |
The rest of the example code that I ganked. | |
// 3. Draw arrows on second image to show movement | |
for (int x=0; x<frame2->width; x=x+10) { | |
for (int y=0; y<frame2->height; y=y+10) { | |
int vel_x_here = (int)cvGetReal2D( vel_x, y, x); | |
int vel_y_here = (int)cvGetReal2D( vel_y, y, x); | |
cvLine( frame2, cvPoint(x, y), cvPoint(x+vel_x_here, | |
y+vel_y_here), cvScalarAll(255)); |
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
int potpin = 0; | |
int speakerPin = 9; | |
int redPin = 10; | |
int bluePin = 12; | |
int high = 0, low = 500; | |
void setup() | |
{ | |
pinMode(speakerPin, OUTPUT); |
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
#include <iostream> | |
#include <map> | |
#include <string> | |
using namespace std; | |
map<char, char> alternatives; | |
void traverse(string prefix, string rest) | |
{ | |
if (rest.empty()) { |
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
-- Playing around with ContraFunctors | |
-- http://blog.ezyang.com/2010/07/flipping-arrows-in-coburger-king/ | |
class ContraFunctor t where | |
contramap :: (a -> b) -> t b -> t a | |
newtype ContraF a b = ContraF (b -> a) | |
instance ContraFunctor (ContraF a) where | |
contramap g (ContraF f) = ContraF (f . g) |
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 SubdivisionTree(object): | |
"""docstring for SubdivisionTree""" | |
def __init__(self, top, right, bottom, left, element=None): | |
self.top = top | |
self.right = right | |
self.bottom = bottom | |
self.left = left | |
self.element = element |
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
import urllib | |
from xml.dom import minidom | |
from xml.dom.minidom import parse, parseString | |
display_tags = ["d:PartitionKey", "d:RowKey", "d:TimeStamp", "d:entityid", | |
"d:name", "d:address", "d:weburl", "d:gis_id", "d:gender", | |
"d:offensedescription"] | |
def GetData(): | |
url = "http://ogdi.cloudapp.net/v1/dc/JuvenileArrestsCharges/?$filter=gender%20eq%20'F'" |
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
# Via: http://palewi.re/posts/2009/03/03/django-recipe-dump-your-queryset-out-as-a-csv-file/ | |
import csv | |
from django.db.models.loading import get_model | |
def dump2csv(qs, outfile_path): | |
""" | |
Takes in a Django queryset and spits out a CSV file. | |
Usage:: |
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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.db import models, migrations | |
class AlterOrderWithRespectTo(migrations.AlterOrderWithRespectTo): | |
""" | |
Represents a change with the order_with_respect_to option. | |
""" |
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 | |
""" | |
Run me like: python ohlife_to_dayone.py /Users/Kobold/Downloads/ohlife_20140925.txt | |
""" | |
import envoy | |
import re | |
import sys | |
def entries(filename): | |
timestamp = None |