Skip to content

Instantly share code, notes, and snippets.

View aniversarioperu's full-sized avatar

AniversarioPeru aniversarioperu

View GitHub Profile
@aniversarioperu
aniversarioperu / lineNumbers_vim
Created August 18, 2013 09:36
add line numbers to text in Vim
# Taken from http://stackoverflow.com/questions/252766/add-line-numbers-in-vim
:%s/^/\=line('.')/
@aniversarioperu
aniversarioperu / socios_pva_versus_total.csv
Last active December 24, 2015 21:09
Datos para plot: El 1.7% se lleva el 24% de la plata #intervenganAPDAYC
socios_pva 1.725
resto_de_socios 98.275
socios principales vitalicios y activos 24.0813801372
resto de socios 75.9186198628
@aniversarioperu
aniversarioperu / mas_productivos.py
Last active December 25, 2015 00:59
Cuanto dinero de las regalías se lleva el consejo directivo de APDAYC?
# -*- coding: utf-8 -*-
import codecs
import prettyplotlib as ppl
import numpy as np
from prettyplotlib import plt
import re
f = codecs.open("tmp_mas_productivos.txt", encoding="utf-8")
data = f.read()
f.close()
@aniversarioperu
aniversarioperu / bajar_paginas_congreso.sh
Last active December 25, 2015 10:39
Script para bajarse las páginas del Congreso del Perú que contiene links a los proyectos de ley presentados por los congresistas (año 2013).
#!/bin/bash
for i in {0..900..100}
do
if [ $i = 0 ]; then
torsocks wget "http://www2.congreso.gob.pe/Sicr/TraDocEstProc/CLProLey2011.nsf/PAporNumeroInverso?OpenView"
else
torsocks wget "http://www2.congreso.gob.pe/Sicr/TraDocEstProc/CLProLey2011.nsf/PAporNumeroInverso?OpenView&Start=$i"
fi
done
@aniversarioperu
aniversarioperu / extraer_proyectos_de_ley.py
Last active December 25, 2015 10:49
Extraer proyectos de ley, y nombre de los autores, presentados durante el año 2013 (hasta octubre)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socks
import cookielib
import socket
from bs4 import BeautifulSoup
import requests
import sys
import re
@aniversarioperu
aniversarioperu / plot.py
Created October 13, 2013 18:43
Script para plotear número de proyectos de ley presentados por cada congresista
# -*- coding: utf-8 -*-
import codecs
import prettyplotlib as ppl
import numpy as np
from prettyplotlib import plt
import csv
import pickle
import sys
# Modified from http://pythonism.wordpress.com/2010/04/18/a-simple-chatbot-in-python/
b = open('tradiciones_peruanas.txt')
text = []
for line in b:
line = line.strip()
for word in line.split():
import pickle
import random
import sys
import re
# Modified from http://pythonism.wordpress.com/2010/04/18/a-simple-chatbot-in-python/
a = open('lexicon-luke','rb')
successorlist = pickle.load(a)
a.close()
@aniversarioperu
aniversarioperu / tuit_chat.py
Created October 19, 2013 20:04
tuitbot que chatea con trolls.
#!/usr/bin/env python
# -*- coding: UTF8 -*-
import codecs;
import os;
import datetime;
import re;
import bitly;
import subprocess;
import time;
import sys;
@aniversarioperu
aniversarioperu / bajar_resoluciones.sh
Created October 20, 2013 16:24
Script para bajarse resoluciones del Ministerio de Justica durante el 2do gobierno aprista
## Lista de links de las Normas del Ministerio de Justicia del 2006 al 2011
# Bajar fechas 00-01-06 hasta 39-09-09
curl -o '#1#2-0#3-0#4.pdf' 'http://spij.minjus.gob.pe/Normas/textos/[0-1][0-1]0[1-1]0[6-6]T.pdf'
sleep $[ ( RANDOM % 10 ) + 1]m
# Bajar fechas 00-01-06 hasta 39-09-09
curl -o '#1#2-0#3-0#4.pdf' 'http://spij.minjus.gob.pe/Normas/textos/[0-3][0-9]0[1-9]0[6-9]T.pdf'
sleep $[ ( RANDOM % 10 ) + 1]m