Skip to content

Instantly share code, notes, and snippets.

@robinkraft
robinkraft / domino_event_log_5c777df946e0fb0008ada92c_condensed.json
Created Feb 28, 2019
cat ~/Downloads/domino_event_log_5c777df946e0fb0008ada92c.json | jq ".[].description"
View domino_event_log_5c777df946e0fb0008ada92c_condensed.json
"Request to deploy app with id 5c777df946e0fb0008ada92c"
"Deploying app with id 5c777df946e0fb0008ada92c"
"Deployment created: run-5c777df946e0fb0008ada92c"
"Pod created: run-5c777df946e0fb0008ada92c-6794d486b8-sxsp4"
"Scaled up replica set run-5c777df946e0fb0008ada92c-6794d486b8 to 1"
"Successfully assigned run-5c777df946e0fb0008ada92c-6794d486b8-sxsp4 to ip-10-0-175-133.us-west-2.compute.internal"
"Pod updated: run-5c777df946e0fb0008ada92c-6794d486b8-sxsp4"
"Deployment updated: run-5c777df946e0fb0008ada92c"
"Deployment updated: run-5c777df946e0fb0008ada92c"
"Pod updated: run-5c777df946e0fb0008ada92c-6794d486b8-sxsp4"
View minikube_uninstall.sh
minikube stop; minikube delete &&
docker stop $(docker ps -aq) &&
rm -rf ~/.kube ~/.minikube &&
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
launchctl stop '*kubelet*.mount' &&
launchctl stop localkube.service &&
launchctl disable localkube.service &&
sudo rm -rf /etc/kubernetes/ &&
docker system prune -af --volumes
@robinkraft
robinkraft / upload.py
Last active Dec 7, 2017
Upload a raster to mapbox.com using the Mapbox Upload API
View upload.py
from mapbox import Uploader
u = Uploader() # handles authentication
tileset = 'username.tileset_name' # name your tileset
url = u.stage(open('mosaic_final.tif')) # upload happens here
u.create(url, tileset, name=fname) # starts the tiling job
@robinkraft
robinkraft / download.py
Last active Apr 20, 2020
Unofficial client for the Planet.com satellite image catalog and API, originally part of Planet's quickstart guides. https://developers.planet.com/docs/quickstart/
View download.py
#!/usr/bin/env python
import argparse
import os
import requests
import json
import sys
import logging
import datetime
@robinkraft
robinkraft / firemap.html
Last active Oct 13, 2017
Embed code for fire map
View firemap.html
<iframe src="https://api.mapbox.com/styles/v1/robinkraft/cj8nn4lvp7yoq2ro1klhjltw8.html?title=true&access_token=pk.eyJ1Ijoicm9iaW5rcmFmdCIsImEiOiJQLUp2RU9NIn0.B20c6fiHx0NCgfSOE3HYbw#13.15/38.4816/-122.7019" width="640" height="480”>
@robinkraft
robinkraft / toa_reflectance.py
Created Jan 20, 2017
calculate toa reflectance for Planet Labs data - not an ideal script, but you get the idea
View toa_reflectance.py
import os
import argparse
from bs4 import BeautifulSoup
import rasterio
SUFFIX = '_BGRN_Analytic'
BASEPATH = '/Users/robinkraft/gitlab/change/hackathon/robin/data/'
@robinkraft
robinkraft / learning_rates.ipynb
Last active Nov 29, 2016
Showing difference between different methods for changing learning rates in Keras.
View learning_rates.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@robinkraft
robinkraft / prep_data.py
Last active Nov 21, 2016
Data prep for Kaggle's State Farm competition
View prep_data.py
import os
from glob import glob
import shutil
import pandas as pd
def choose_subjects(df, count):
# group the frame by the subject in the image
subjects = df.groupby('subject')
@robinkraft
robinkraft / prep_data.py
Last active Jun 29, 2017
Script to process dogs vs. cats data from Kaggle for use with VGG ImageNet submission. See https://www.kaggle.com/c/dogs-vs-cats-redux-kernels-edition/
View prep_data.py
import os
import random
import glob
import shutil
def get_dc_paths(path):
"""Given a path filled with dog & cat files, make separate lists of both."""
cats = []
dogs = []
@robinkraft
robinkraft / f250-cdm.clj
Last active Aug 29, 2015
convert FORMA 250m data into common data model suitable for GlobalForestWatch.org website
View f250-cdm.clj
(use 'forma.hadoop.jobs.postprocess)
(in-ns 'forma.hadoop.jobs.postprocess)
(defn f250->cdm
[src t-res zoom]
(let [epoch (date/datetime->period t-res "2000-01-01")]
(<- [?x ?y ?z ?min-period]
(src ?line)
(clojure.string/split ?line #"\t" :> ?lat-str ?lon-str ?date-str)
(read-string ?lat-str :> ?lat)
You can’t perform that action at this time.