Skip to content

Instantly share code, notes, and snippets.

View pudo's full-sized avatar

Friedrich Lindenberg pudo

View GitHub Profile
@pudo
pudo / export.py
Created April 21, 2015 14:51
Data exporter for OpenNames.org
import os
import json
import dataset
import unicodecsv
from datetime import datetime
engine = dataset.connect('postgresql://localhost/opennames.org')
account_tbl = engine['account']
accounts = {a.get('id'): a for a in account_tbl}
@pudo
pudo / scrape.py
Last active August 29, 2015 14:16
Scraper for the Mozambique Gazette, Pt. III
# coding: utf-8
import os
import shutil
import requests
import tempfile
from urllib import urlretrieve
from urlparse import urljoin
from lxml import html
AUTH = (os.environ.get('DOCCLOUD_USER'),
@pudo
pudo / README.md
Created February 22, 2015 08:29
Moz Concessions

README is empty

@pudo
pudo / README.md
Created February 22, 2015 08:29
Moz Concessions

README is empty

@pudo
pudo / extractives_model.txt
Created January 23, 2015 18:06
NRGI mock data model
commodity
id
label
concession_type
id
label
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
<rdf:RDF xmlns="http://pudo.org/celestial-emporium#"
import math
from pprint import pprint
#from cubes.model import Cell
from openspending.core import create_app
from openspending.model import Dataset
app = create_app()
@pudo
pudo / cubes_test.py
Last active August 29, 2015 14:12
Experimenting with OS/cubes
from cubes.providers import ModelProvider
from cubes.model import Cube, Measure, MeasureAggregate, create_dimension
from cubes.backends.sql.store import SQLStore
from cubes.errors import NoSuchCubeError, NoSuchDimensionError
from cubes import Workspace
from openspending.core import create_app, db
from openspending.model import Dataset
from openspending.model.dimension import AttributeDimension
from openspending.model.dimension import DateDimension
### Keybase proof
I hereby claim:
* I am pudo on github.
* I am pudo (https://keybase.io/pudo) on keybase.
* I have a public key whose fingerprint is FF97 B5A1 FBA1 C7D1 4926 ABFF 6B33 881D 2DA6 741F
To claim this, I am signing this object:
@pudo
pudo / eas.py
Created December 5, 2014 08:20
import requests
from lxml import html
URL = 'http://neas.environment.gov.za/portal/ApplicationsPerEAP_Report.aspx'
sess = requests.Session()
r = sess.get(URL)
doc = html.fromstring(r.content)
form = {}