Skip to content

Instantly share code, notes, and snippets.

Avatar

Jesse Crocker JesseCrocker

View GitHub Profile
@JesseCrocker
JesseCrocker / gist:c099b846116aca082c5d
Last active Sep 14, 2022
gdal2tiles resampling speed
View gist:c099b846116aca082c5d
$ for i in average near bilinear cubic cubicspline lanczos antialias;do echo $i; time gdal2tiles.py -r $i PR_Corozal_20130920_TM_geo.pdf.tif tiles.$i; done
average
gdal2tiles.py -r $i PR_Corozal_20130920_TM_geo.pdf.tif tiles.$i 129.10s user 3.27s system 98% cpu 2:14.95 total
near
gdal2tiles.py -r $i PR_Corozal_20130920_TM_geo.pdf.tif tiles.$i 55.01s user 2.64s system 97% cpu 59.276 total
bilinear
gdal2tiles.py -r $i PR_Corozal_20130920_TM_geo.pdf.tif tiles.$i 99.11s user 4.06s system 97% cpu 1:45.64 total
@JesseCrocker
JesseCrocker / tilenames.py
Last active Sep 7, 2022
Translates between lat/long and the slippy-map tile numbering scheme - tilenames.py -t 16/10470/25324 -g | geojsonio
View tilenames.py
#!/usr/bin/env python
#-------------------------------------------------------
# Translates between lat/long and the slippy-map tile
# numbering scheme
#
# http://wiki.openstreetmap.org/index.php/Slippy_map_tilenames
#
# Written by Oliver White, 2007
# This file is public-domain
#-------------------------------------------------------
@JesseCrocker
JesseCrocker / background.xml
Created Feb 18, 2014
Test mapnik with gdal driver using the GDAL_WMS driver with the TMS mini driver. On OS X this works correctly, on linux the background is always greyscale.
View background.xml
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://otile1.mqcdn.com/tiles/1.0.0/sat/${z}/${x}/${y}.png</ServerUrl>
</Service>
<DataWindow>
<UpperLeftX>-20037508.34</UpperLeftX>
<UpperLeftY>20037508.34</UpperLeftY>
<LowerRightX>20037508.34</LowerRightX>
<LowerRightY>-20037508.34</LowerRightY>
<TileLevel>18</TileLevel>
@JesseCrocker
JesseCrocker / sdlog2_dump.py
Created Nov 2, 2014
Convert binary log from APM to gpx or csv
View sdlog2_dump.py
#!/usr/bin/env python
from __future__ import print_function
"""
Dump binary log generated by PX4's sdlog2 or APM as CSV or GPX
Based on https://github.com/PX4/Firmware/blob/master/Tools/sdlog2/sdlog2_dump.py
Modified by Jesse Crocker to generate GPX, and work with logs that dont have a TIME message.
"""
@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