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 <Wire.h> | |
#include <SPI.h> | |
#include <Ethernet.h> | |
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE }; | |
EthernetServer server(80); | |
const int lockPin = 2; | |
const int ledPin = 13; |
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
#!/bin/bash | |
URL=$1 | |
LOG_FILE=$2 | |
WORKER_STEPS=( 10 100 200 500 1000 1500 ) | |
DELAY=10 | |
TEST_LENGTH=60s | |
for WORKERS in "${WORKER_STEPS[@]}"; do |
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 httplib,pycurl,json | |
from django.conf import settings | |
from tasks import ProcessTweet | |
QUERY="android" | |
class Twitter(): | |
default_retry_delay = 5 | |
def run(self,query): | |
self.buffer = "" |
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 urllib2,httplib,re | |
def url_title(url,**kwargs): | |
title = None | |
request = urllib2.Request(url) | |
try: | |
response = urllib2.urlopen(request) | |
data = response.read() | |
except urllib2.HTTPError: | |
data = None |
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 urllib2, json, base64, sys, termios, tty, os | |
USER = "your_twitter_user" | |
PASS = "your_twitter_pass" | |
neg_filename = "negative.txt" | |
pos_filename = "postive.txt" | |
queries = ['awesome','beautiful','shit','fuck','android','iphone','blackberry','windows','linux','apple','google'] |
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
USER = "your_twitter_user" | |
PASS = "your_twitter_pass" | |
if "your_twitter" in USER+PASS: | |
print "You didn't set your twitter username and password in the script!" | |
USER = raw_input("Username>") | |
PASS = raw_input("Password>") | |
import urllib2, json, base64, sys, os |
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 time,sys | |
total_loops = 500; | |
complete_loops = 0; | |
while (complete_loops < total_loops): | |
percent = int(complete_loops*100/total_loops) | |
time.sleep(1) | |
complete_loops +=1 |
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
#!/bin/python | |
import random | |
def rgb_to_int(r,g,b): | |
i = str() | |
for c in r,g,b: | |
for d in str("%03d" % (c,)): | |
i += '%s%s%s' % (d,d,d) | |
return i |
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 goal is to emulate the following bash line properly in python: | |
#wget -O - "https://github.com/downloads/Tawlk/synt/sample_data.bz2" | bzcat | sqlite3 sample_data.db | |
import bz2 | |
import sqlite3 | |
import time | |
import urllib2 | |
import os | |
from cStringIO import StringIO |
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
from nltk.probability import DictionaryProbDist | |
from nltk import NaiveBayesClassifier | |
train_samples = { | |
'I hate you and you are a bad person': 'neg', | |
'I love you and you are a good person': 'pos', | |
'I fail at everything and I want to kill people' : 'neg', | |
'I win at everything and I want to love people' : 'pos', | |
'sad are things are heppening. fml' : 'neg', | |
'good are things are heppening. gbu' : 'pos', |