Skip to content

Instantly share code, notes, and snippets.

@arivero
arivero / gist:3499187
Created August 28, 2012 15:36
estadistica de una distribucion de nodos
if True:
informa=0
print cantidad[:50]
print numero[:50]
ricos=sum(cantidad[:len(cantidad)/100])
print "hemos repartido ", total , " entre ", sum(numero),
print " (media=",1.0*total/sum(numero), ")", reparto
print "el mas rico posee ", 1.0*cantidad[0]*sum(numero)/total, "veces mas que la media"
ricosnum,ricoscant,xx=0,0,-1
for corte in 10000,1000,100,20,10,5,10.0/3,10.0/4,2,10.0/6,10.0/7,10.0/8,10.0/9,10.0/9.5,10.0/9.9:
#!/usr/bin/env python
"""Classes to produce videos from igraph plots.
"""
from __future__ import with_statement
from contextlib import contextmanager
from igraph.drawing import BoundingBox, Plot
from shutil import rmtree
@arivero
arivero / gist:8529263
Last active January 3, 2016 22:38
reparto aleatorio, con crecimiento de nodos
from random import randint
from array import array
import sys
total=10000
#reparto=20000
reparto=int(sys.argv[1])
cantidad=array('l',(1 for x in xrange(total)))
for i in xrange(reparto-total):
concede=randint(1,total)
x, ticks =-1,0
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import sys
import re
import time
from itertools import combinations
from collections import Counter,defaultdict
from datetime import datetime
import urllib2
@arivero
arivero / _.md
Created September 26, 2014 12:01
Tributary inlet
@arivero
arivero / _.md
Created September 26, 2014 12:01
Tributary inlet
@arivero
arivero / StandardModelLog.tex
Last active June 6, 2017 19:53
tikz/pkgplot logplot of quarks and leptons in Standard Model of Elementary Particles
\documentclass[a4paper,landscape]{article}
%remember to install pfgplots
%\usepackage{gensymb}
\usepackage{graphicx}
%\usepackage{amsmath}
\usepackage{adjustbox} %either import it, or remove the begin...end
%{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
@arivero
arivero / Asimpletally.py
Last active August 29, 2015 14:08
Contador rapido para el plaintext.json del voto de Resoluciones de "Podemos", adaptado de agoravoting
from collections import defaultdict,Counter
import json
plaintexts_file=open("plaintexts_json")
question=defaultdict(int)
total_count=0
total=Counter()
for line in plaintexts_file.readlines():
total_count += 1
try:
number = int(line[1:-2]) - 1
@arivero
arivero / podemosPrimariasGene
Created July 24, 2015 18:00
resumen por euipos de las primarias de podemos a las generales
Equipo PABLO IGLESIAS
1.- Íñigo Errejón Galván (45122 votos, 76.12%)
2.- Carolina Bescansa (42901 votos, 72.37%)
...
61.- Mª Dolores Marín-Albo Montes (35989 votos, 60.71%)
68.- Arnau Mallol I Baró (35685 votos, 60.2%)
UTOPIA Y DIGNIDAD
@arivero
arivero / borrador.py
Last active July 8, 2016 13:42
elecciones 2016
# coding: utf-8
# In[1]:
f=open("test.json")
# In[2]:
import json
from collections import OrderedDict
# In[3]:
j=json.load(f,object_pairs_hook=OrderedDict)
# In[8]:
from collections import Counter,defaultdict