Skip to content

Instantly share code, notes, and snippets.

Avatar

Jesse Crocker JesseCrocker

View GitHub Profile
@JesseCrocker
JesseCrocker / README.md
Last active Jun 13, 2022
Simple ECS service deploy script
View README.md

Deploy updates to aws ecs services based on github commits. Posts deploy notifications to slack.

Assumptions:

  • Task definitions map 1:1 with services, and they have the same name.
  • Code is stored on github
  • You want to deploy the latest commit in a branch
  • Docker images are tagged with commit SHA
  • Docker images are stored on AWS ECR
@JesseCrocker
JesseCrocker / gpx-photo.py
Created May 21, 2014
Use a gpx file to geotag a set of photos
View gpx-photo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from optparse import OptionParser
import os
import sys
import pyexiv2
import logging
import gpxpy
import gpxpy.gpx
import datetime
@JesseCrocker
JesseCrocker / convert-image-urls-to-data.py
Created Jul 9, 2014
Convert external images in an html to data URIs
View convert-image-urls-to-data.py
#!/usr/bin/env python
import os
import re
from bs4 import BeautifulSoup
import urllib2
from urlparse import urljoin
from optparse import OptionParser
import logging
def url_can_be_converted_to_data(tag):
@JesseCrocker
JesseCrocker / aws.conf
Created Feb 15, 2016
How to install AWS CloudWatch Logs Agent to send logs from a docker container to AWS Cloudwatch, without using a linked container for logging.
View aws.conf
[plugins]
cwlogs = cwlogs
[default]
region = ap-southeast-2
@JesseCrocker
JesseCrocker / build-gdal-combined-lib.sh
Last active Dec 7, 2020
Scripts for building Gdal into a static library for iOS, build-gdal-combined-lib.sh will build a single lib with armv7 armv7s arm64 and simulator slices
View build-gdal-combined-lib.sh
#!/bin/bash
PREFIX=`pwd`/install/
rm -rf $PREFIX
mkdir $PREFIX
LOG=./log
rm -rf $LOG
mkdir $LOG
if [ -e ${PREFIX} ]
then
@JesseCrocker
JesseCrocker / setup_tilestache.sh
Last active Nov 26, 2020
Setup Tile Stache Mapnik and postgis2.0 on ubuntu 12.04, you probably don't want to run this as a script, use it as instructions.
View setup_tilestache.sh
#!/bin/bash
#setup tilestache on ubuntu 12.04
#install some basic system software
sudo apt-get -q -y install emacs23-nox
sudo apt-get -q -y install nginx git-core python-pip python-dev python-flup
sudo apt-get -q -y install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
sudo pip install -U werkzeug
sudo pip install -U simplejson
sudo pip install -U modestmaps
@JesseCrocker
JesseCrocker / tile_cacher.py
Last active Nov 11, 2020
Script for request map tiles based on a BBOX, for seeding caches.
View tile_cacher.py
#!/usr/bin/env python
#
# Make requests to a tile server to seed the cache
# Created by Jesse Crocker, 6/30/2014
#
# This file is public-domain
#-------------------------------------------------------
from math import *
from optparse import OptionParser
@JesseCrocker
JesseCrocker / get-dems.sh
Last active Jul 23, 2020
Download all SRTM30 dems, convert to HGT
View get-dems.sh
#!/bin/bash
function gdal_pixel_count() {
if [ -z "$1" ]; then
echo "Missing arguments. Syntax:"
echo " gdal_extent <input_raster>"
return
fi
EXTENT=$(gdalinfo $1 |\
grep "Size is" |\
@JesseCrocker
JesseCrocker / collage.py
Last active Jun 16, 2020
Create a collage of images, filling all space without cropping. Implements algorithm presented in https://www.crispymtn.com/stories/the-algorithm-for-a-perfectly-balanced-photo-gallery
View collage.py
#!/usr/bin/env python
from operator import itemgetter
from optparse import OptionParser
import logging
from PIL import Image
from math import ceil, floor
import sys
"""
View valhalla diary.md

Ultimate Goal: valhalla running on AWS ECS, behind a load balancer, in multiple regions, with auto scaling, with data updating once a week.

Diary

First goal: Build with docker, then cut tiles from a small extract and get server to run locally.

jesse:projects/ $ mkdir ~/valhalla-data
jesse:projects/ $ cd ~/valhalla-data
jesse:projects/ $ wget http://download.geofabrik.de/north-america/us/california-latest.osm.pbf
[output abbreviated]
jesse:projects/ $ cd ~/projects