Skip to content

Instantly share code, notes, and snippets.

Building GDAL 1.9.x with ESRI FileGDB support on OS X Lion

  • Download the SDK from ESRI's website http://resources.arcgis.com/content/geodatabases/10.0/file-gdb-api
  • Extract the SDK, and put the contents of the directory in a known location, I used ~/local/filegdb. Here's an example path to one of the files: ~/local/filegdb/lib/libFileGDBAPI.dylib
  • I use ~/local/filegdb so it can stay isolated in it's own place. You can put it anywhere, but the next few steps might be different.
  • Go into the directory containing the FileGDB SDK, e.g. ~/local/filegdb
  • ESRI built these dylib's using @rpath's, so to avoid needing to mess with DYLD_LIBRARY_PATH, I updated the @rpath's using install_name_tool. There might be a more elegant way to handle this. If so, comments are welcome!
  • Here are the commands I used to patch the dylibs, this is not required if you want to use DYLD_LIBRARY_PATH yourself:
@richarddunks
richarddunks / gist:5910271
Last active December 19, 2015 06:19 — forked from zhm/gist:2005158

Building GDAL 1.9.x with ESRI FileGDB support on OS X Lion

  • Download the SDK from ESRI's website http://www.esri.com/apps/products/download/index.cfm?fuseaction=#File_Geodatabase_API_1.3
  • Extract the SDK, and put the contents of the directory in a known location, I used ~/local/filegdb. Here's an example path to one of the files: ~/local/filegdb/FileGDB_API/lib/libFileGDBAPI.dylib
  • I use ~/local/filegdb so it can stay isolated in it's own place. You can put it anywhere, but the next few steps might be different.
  • Go into the directory containing the FileGDB SDK, e.g. ~/local/filegdb/FileGDB_API
  • ESRI built these dylib's using @rpath's, so to avoid needing to mess with DYLD_LIBRARY_PATH, I updated the @rpath's using install_name_tool. There might be a more elegant way to handle this. If so, comments are welcome!
  • Here are the commands I used to patch the dylibs, this is not required if you want
Steps:
Set up EBS
21Created 1 TB EBS
Created 64 Bit Amazon Linux AMI 2012.09 M1 Medium 3.7 gb ram, 2 ECUs
Connect to ec2 instance via ssh
chmod 400 IFS-KeyPair.pem
ssh -v -i IFS-KeyPair.pem ec2-user@ec2-54-234-14-65.compute-1.amazonaws.com
Note: Do not replace ec2-user with your user id. This is a AWS Amazon AMI requirement.

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

'''Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
'''
def encode_coords(coords):
'''Encodes a polyline using Google's polyline algorithm
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
for more information.
@richarddunks
richarddunks / nyc_bicycle_racks_nearest_neighbor.sql
Last active August 29, 2015 14:14
Self Join to find nearest neighbor for bicycle racks in NYC
--Self join in SQL to find minimum distance between NYCDOT bicycle racks
--using this data on CartoDB: https://richard-datapolitan.cartodb.com/tables/dot_bicycle_racks
--This is based on a problem presented by Joss Philippe at the MaptimeNYC Jan 28,2015 meeting.
--http://www.meetup.com/Maptime-NYC/events/219945042/
--This will calculate a self join of each data point to every other and calculate the distance
--Since the data is in WGS84, the distance measure is in radians. We'll calculate meters later
WITH query AS (
SELECT d1.cartodb_id AS cid1, d2.cartodb_id AS cid2, ST_DISTANCE(d1.the_geom,d2.the_geom) AS dist
FROM dot_bicycle_racks d1, dot_bicycle_racks d2 --the self join happens here
@richarddunks
richarddunks / deploy-django.md
Created January 5, 2022 22:36 — forked from rmiyazaki6499/deploy-django.md
Deploying a Production ready Django app on AWS

Deploying a Production ready Django app on AWS

In this tutorial, I will be going over to how to deploy a Django app from start to finish using AWS and EC2. Recently, my partner Tu and I launched our app Hygge Homes (a vacation home rental app for searching and booking vacation homes based off Airbnb) and we wanted to share with other developers some of the lessons we learned along the way.

Following this tutorial, you will have an application that has:

  • An AWS EC2 server configured to host your application
  • SSL-certification with Certbot
  • A custom domain name
  • Continuous deployment with Github Actions/SSM Agent
'''
get the dock status and compute summary statistics for tweeting
'''
#need to wrap in try-catch
r = requests.get('http://www.citibikenyc.com/stations/json')
totalDocks_sum = 0
avail_bikes_sum = 0
in_service_station_sum = 0
for station in r.json()['stationBeanList']:
if station['statusKey'] == 1:
@richarddunks
richarddunks / ssh_config_example_macOS.sh
Created March 7, 2023 03:16 — forked from datapolitan/ssh_config_example_macOS.sh
Example SSH config file for two Github hosts
#user1 account
Host github.com-user1
HostName github.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
#user2 account
Host github.com-user2
@richarddunks
richarddunks / setup.sh
Created March 7, 2023 03:17 — forked from datapolitan/setup.sh
How to setup the Protobuf Files to parse the NYCT GTFS-RT Feeds (because they don't make it easy)
# Download the proto files
wget http://datamine.mta.info/sites/all/files/pdfs/nyct-subway.proto.txt
wget https://developers.google.com/transit/gtfs-realtime/gtfs-realtime.proto
# rename the NYCT proto file to drop the .txt extension
mv nyct-subway.proto.txt nyct-subway.proto
# install the protobuf-compiler
sudo yum install protobuf-compiler