Skip to content

Instantly share code, notes, and snippets.

@martinburch
martinburch / index.html
Last active August 29, 2015 14:11 — forked from jatorre/index.html
CartoDB blurring trials
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--Edit the title of the page-->
<title>CartoDB Point Clustering</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
@martinburch
martinburch / centroidGeocoder.py
Last active October 19, 2015 06:09
Centroid, Kansas
#!/usr/bin/env python
# encoding: utf-8
"""
1. Load places from CSV file
2. Run geocoders
3. Write results to files
"""
import geocoder
@martinburch
martinburch / index.md
Last active January 13, 2016 01:03 — forked from andy-esch/index.md
Intermediate SQL at CartoDB -- January 12, 2016

CartoCamp Intermediate SQL

January 11th, 2016

Instructors

Andy Eschbacher, Map Scientist, @MrEPhysics

Stuart Lynn, Map Scientist, @Stuart_Lynn

@martinburch
martinburch / nestedGet.py
Created February 23, 2017 18:38
recursive function to get value from dictionary given a list of nested keys
#!/usr/bin/env python
# encoding: utf-8
def nestedGet(d,p):
if len(p) > 1:
try:
return nestedGet(d.get(p[0]),p[1:])
except AttributeError:
return None
if len(p) == 1:
@martinburch
martinburch / demo.py
Last active March 2, 2022 08:56
Python MySQL upsert
#!/usr/bin/env python
# encoding: utf-8
import MySQLdb
from upsert import upsert
db = MySQLdb.connect(host="localhost", user="root", passwd="", db="demo", charset="utf8")
c = db.cursor()
import warnings
warnings.filterwarnings("ignore", "Unknown table.*")
@martinburch
martinburch / csvpys-one-liners
Last active February 9, 2024 21:12
One liners: commands to clean up your data using csvkit with csvpys on a Mac. ("So your data doesn't get the last laugh!")
#!/bin/bash
# Install csvkit with csvpys
# (csvpys hasn't been pulled back into the main csvkit repo that you can pip install)
git clone https://github.com/cypreess/csvkit.git
cd csvkit
python setup.py build
sudo python setup.py install
cd ~