Skip to content

Instantly share code, notes, and snippets.

View versae's full-sized avatar

Javier de la Rosa versae

View GitHub Profile
@versae
versae / twitterdino.pde
Created January 30, 2012 02:41
Send the last tweet and sentiment about the message to Arduino
#define GREEN 8
#define RED 12
const int sepToken = 666;
int val = 0;
int lastVal = 0;
void setup() {
pinMode(GREEN, OUTPUT);
pinMode(RED, OUTPUT);
@versae
versae / gist:1381199
Created November 20, 2011 23:54
Convert JSON files from ViralHeat API into CSV's files
# -*-*- coding: utf-8 -*-
import codecs
import csv
from StringIO import StringIO
from json import loads
# Taken from http://docs.python.org/library/csv.html#csv-examples
class UnicodeWriter(object):
@versae
versae / gist:1381161
Created November 20, 2011 23:36
Parse manifesto files to get positive and negative sentiment.
#!/usr/bin/python
import urllib
import requests
party = "name_of_the_party"
lines = []
for line in open("programa-%s.txt" % party , "r"):
l = line.strip()
try:
int(l)
@versae
versae / mirror_gephi_graph.py
Created April 26, 2011 15:29
Mirroring by symmetry on axe X (reflection) of a graph in Gephi Script Console
for node in getGraph().nodes:
x, y = getPos(node)
setPos(node, -x, y)