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 -*- | |
import logging | |
from urlparse import urlparse | |
import MySQLdb | |
from MySQLdb.cursors import DictCursor | |
logger = logging.getLogger(__name__) |
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
digraph G { | |
graph [fontname="Helvetica", rankdir="LR", compound=true, | |
] | |
edge[fontname="Helvetica", fontsize=10, arrowsize=0.6, | |
headport=w, tailport=e | |
] | |
node[shape=Mrecord, fontname="Helvetica", fontsize=12, style=filled, | |
colorscheme="pastel28"] |
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
package main | |
import ( | |
"bufio" | |
"net" | |
) | |
type Client struct { | |
incoming chan string | |
outgoing chan string |
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 -*- | |
#!/usr/bin/env python | |
from math import sqrt, ceil | |
import itertools | |
import time | |
import sys | |
from tabulate import tabulate | |
from fractions import gcd |
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 -*- | |
# https://rosettacode.org/wiki/Sieve_of_Eratosthenes#Python | |
import time | |
def iprimes2(limit): | |
yield 2 | |
if limit < 3: |
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 -*- | |
import sys | |
import os | |
import argparse | |
import urlparse | |
import json | |
import pickle | |
from Queue import 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
class switch(object): | |
def __init__(self, expr): | |
self.expr = expr | |
self.cases = {} | |
self._default = None | |
def __call__(self, expr): |
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
void setup() { | |
// inicializa a porta serial | |
Serial.begin(9600); | |
} | |
void loop() { | |
// le o valor do sensor | |
int v = analogRead(0); | |
// faz uma aproximacao | |
float dist = (2914.0 / (v + 5)) - 1; |