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/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+)?$') |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
### Keybase proof | |
I hereby claim: | |
* I am themiurgo on github. | |
* I am themiurgo (https://keybase.io/themiurgo) on keybase. | |
* I have a public key ASALFpBnQSBJmtUiWX4YKGct8fVYAYJTk8hJBUYG55dEwwo | |
To claim this, I am signing this 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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js"></script> | |
<style> | |
div.container-fluid { | |
width: 100%; | |
height: 50%; | |
position: relative; |
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 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 | |
""" |
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
<!DOCTYPE html> | |
<html> | |
<head><meta charset="utf-8" /> | |
<title>2015-01-18 Python and Folium</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<style type="text/css"> | |
/*! |
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
import requests | |
API_KEY = "" # FILL THIS | |
class Geocoder(object): | |
endpoint = "http://www.mapquestapi.com/geocoding/v1/batch" | |
endpoint = "http://open.mapquestapi.com/geocoding/v1/batch" | |
def __init__(self, api_key): | |
self.api_key = api_key |
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 | |
# 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 |
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
import collections | |
import time | |
import requests | |
import pymongo | |
import ratelim | |
import textwrap | |
G_GEO_SUCCESS = 200 | |
G_GEO_SERVER_ERROR = 500 | |
G_GEO_MISSING_QUERY = 601 |
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
# FILL FILENAME | |
# Return the seconds from last modification of a file, among a list of files | |
file=$(ls FILENAME -hant --time-style +%s | head -n1 | awk '{print $6}' ) ; now=$(date +%s); echo $((now-file)) |
NewerOlder