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
for node in getGraph().nodes: | |
x, y = getPos(node) | |
setPos(node, -x, y) |
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 | |
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) |
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 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): |
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
#define GREEN 8 | |
#define RED 12 | |
const int sepToken = 666; | |
int val = 0; | |
int lastVal = 0; | |
void setup() { | |
pinMode(GREEN, OUTPUT); | |
pinMode(RED, 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
#!/bin/bash | |
# Script to add a user to Linux system | |
# ------------------------------------------------------------------------- | |
read -p "Enter username: " username | |
read -s -p "Enter password: " password | |
echo "" | |
sudo egrep "^$username" /etc/passwd >/dev/null | |
if [ $? -eq 0 ]; then | |
echo "$username exists!" | |
exit 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
server { | |
listen 80; | |
#server_name yourdomain.com; | |
access_log /home/template/log/access.log; | |
error_log /home/template/log/error.log; | |
location /static/admin { | |
alias /home/template/.virtualenvs/projectenv/lib/python2.7/site-packages/django/contrib/admin/media/; | |
} | |
location /static { |
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 os import path | |
from StringIO import StringIO | |
from PIL import Image as PILImage | |
from django.core.files.base import ContentFile | |
from django.db.models.signals import post_save | |
from django.dispatch import receiver | |
from fiber.models import Image |
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
# http://docs.neo4j.org/chunked/snapshot/rest-api-traverse.html#rest-api-traversal-returning-nodes-below-a-certain-depth | |
try: | |
import simplejson as json | |
except ImportError: | |
import json | |
from neo4jrestclient import client | |
from neo4jrestclient.request import Request | |
from neo4jrestclient.request import NotFoundError |
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
def nodes_length(): | |
return len(g.nodes) |
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
def find_neighbors(n, v, visited=set()): | |
""" | |
Finds a node's neighbors to n degrees of seperation. | |
Param n: degrees of seperation. n > 1 | |
v: node id | |
Return: a list of neighbors to the nth degree with no duplicates or 'NoneType' | |
""" | |
neighbors = set(v.neighbors) |
OlderNewer