Skip to content

Instantly share code, notes, and snippets.


Antonio Lima themiurgo

View GitHub Profile
View gist:7924417ab6e2a7a54bbc47deb8c2d80c
### Keybase proof
I hereby claim:
* I am themiurgo on github.
* I am themiurgo ( on keybase.
* I have a public key ASALFpBnQSBJmtUiWX4YKGct8fVYAYJTk8hJBUYG55dEwwo
To claim this, I am signing this object:
View notebook.html
<!DOCTYPE html>
<head><meta charset="utf-8" />
<title>2015-01-18 Python and Folium</title>
<script src=""></script>
<script src=""></script>
<style type="text/css">
themiurgo / index.html
Last active Sep 8, 2016
:P Language app that switches every day/week
View index.html
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src=""></script>
div.container-fluid {
width: 100%;
height: 50%;
position: relative;
themiurgo /
Created May 29, 2015
Embed folium maps in iPython
def embed(fmaps, width='100%', height='510px', *args, **kwargs):
Embeds a folium map in a IPython/Jupyter notebook.
This method will not work if the map depends on any files (json data). Also this uses
the HTML5 srcdoc attribute, which may not be supported in all browsers.
fmaps -- a single folium map or an iterable containing folium maps
themiurgo /
Created Apr 1, 2015
Paste for NDJSON documents
import sys
import json
import itertools
fnames = sys.argv[1:]
jsons = [(json.loads(i) for i in open(fname)) for fname in fnames]
def paste(iterables):
for docs in itertools.izip_longest(*iterables, fillvalue={}):
import csv
import os
from collections import namedtuple
def read_csv(fname, tabname=None, names=None, headers=True):
with open(fname, "r") as fobj:
if not tabname:
full_basename = os.path.basename(fname)
basename, ext = os.path.splitext(full_basename)
tabname = basename.capitalize()
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""This script was used to generate random test files for the course
of Computer Networks 2014 at University of Birmingham, Computer Science.
Author: Antonio Lima
License: WTFPL
themiurgo /
Last active Apr 9, 2019 — forked from migurski/
Merge two or more geojson files.
#!/usr/bin/env python
from json import load, JSONEncoder
from argparse import ArgumentParser, FileType
from re import compile
import sys
float_pat = compile(r'^-?\d+\.\d+(e-?\d+)?$')
charfloat_pat = compile(r'^[\[,\,]-?\d+\.\d+(e-?\d+)?$')
themiurgo /
Created Sep 10, 2013
MapQuest bulk geocoder
import requests
class Geocoder(object):
endpoint = ""
endpoint = ""
def __init__(self, api_key):
self.api_key = api_key
themiurgo /
Created Sep 25, 2012
Convert a one-line stream of JSON objects into a newline separated (multiline) stream
# Fix all the files and puts them in a 'fixed' subdirectory
mkdir fixed
for f in *.gz; do gunzip -c $f | ruby jsonsm.rb | gzip -c > fixed/$f; done
You can’t perform that action at this time.