Skip to content

Instantly share code, notes, and snippets.

View danhammer's full-sized avatar

Dan danhammer

View GitHub Profile
@danhammer
danhammer / clean.py
Created May 25, 2019 19:06
Clean up and test links for Water Chronology Map and Climate Commons
import requests
from bs4 import BeautifulSoup
import pandas as pd
import re
# Climate Commons (available stories from WayBack Machine)
base = "https://web.archive.org/web/20160822185508/http://climatecommons.earthjournalism.net/map/data/load_stories.php"
res = requests.get(base).json()
@danhammer
danhammer / extract.py
Created June 1, 2019 05:14
quick and dirty test of PDF to text script
from itertools import groupby
from operator import itemgetter
with open("tester2.txt") as f:
content = f.readlines()
spoken = []
i = 1
for line in content:
leading_space = len(line) - len(line.lstrip())
library(ggplot2)
library(ngram)
library(jsonlite)
library(tidyr)
# Setup
script_title = "star_wars_the_force_awakens"
colors <- list(
@danhammer
danhammer / pie.R
Last active November 6, 2019 04:37
pie chart exploration
# pie chart exploration
library(ggplot2)
library(ngram)
library(jsonlite)
library(tidyr)
library(RColorBrewer)
library(dplyr)
library(scales)
@danhammer
danhammer / mines.geojson
Created November 12, 2019 15:55
Recent gold mining activity in the Yanomami territory
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@danhammer
danhammer / cobalt.csv
Created December 4, 2019 02:32
cobalt mines in DRC
1 Eohe 0.33188 28.71258 Lubero Bapere Baredje Maendeleo 300
2 Eita 0.32153 28.69916 Lubero Bapere Baredje Tembe 110
3 Mungu Iko 0.5449917486 28.1851422995 Lubero Bapere Bapaitumba Ehoto NA
4 Kiviri/Tayna -0.352529 28.884528 Lubero Bamate Luenge Vunyakavulivwa NA
5 Makanga -0.036707 28.903945 Lubero Batangi Musindi Ngohi NA
6 Maliyajama 0.864456 29.421061 Beni Beni-Mbau Batangi-Mbau Mamove 50
7 Mununze 0.595655 29.24183 Beni Beni-Mbau Baswagha-Madiwe Mununze 20
8 Kiboto 0.459223 29.09466 Beni Beni-Mbau Baswagha-Madiwe Cantine/Aloya 300
9 Visiki 0.395033 29.224192 Beni Beni-Mbau Madiwe Visiki 50
10 Ruzirantaka (rivière) -1.696243 28.884336 Masisi Bahunde Muvunyi-Shanga Ruzirantaka 27
@danhammer
danhammer / no2.js
Created March 28, 2020 20:35
Plot timeseries of NO2 for Susanna Berkouwer from GEE
var COLOR = {
xinxiang: 'ff0000',
milan: '0000ff',
tehran: '00ff00'
};
var xinxiang = ee.Feature( // xinxiang
ee.Geometry.Rectangle(113.6, 35.1, 114.4, 35.5),
{label: 'xinxiang'});
var milan = ee.Feature( // milan
@danhammer
danhammer / foodbank.geojson
Last active April 18, 2020 01:39
Food banks in North America (ish) from OSM
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.