Skip to content

Instantly share code, notes, and snippets.

View aaronlidman's full-sized avatar

Aaron Lidman aaronlidman

View GitHub Profile
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@surjikal
surjikal / install.md
Last active July 23, 2018 19:05
Presto Installation Instructions for OSX
  1. Install JDK 1.8

  2. See if JAVA_HOME ENV variable is set to 1.8. If not, add this line in your ~/.bashrc:

    export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
    

    And apply the changes to your session:

source ~/.bashrc

Native OS X OpenStreetMap editing app

Reasoning

Prompted by:

Who wants to write a Mac-native OSM editor with me?

— Ian Dees (@iandees) February 9, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

And a few more key followups:

@mourner
mourner / tiles.js
Created February 5, 2014 15:21
Leaflet — get all tile URLs given geographic bounds, tile layer and zoom
function getTileUrls(bounds, tileLayer, zoom) {
var min = map.project(bounds.getNorthWest(), zoom).divideBy(256).floor(),
max = map.project(bounds.getSouthEast(), zoom).divideBy(256).floor(),
urls = [];
for (var i = min.x; i <= max.x; i++) {
for (var j = min.y; j <= max.y; j++) {
var coords = new L.Point(i, j);
coords.z = zoom;
#!/bin/bash
# This script is for exporting MBTiles directly to your Mapbox account.
# Requires a Mapbox account with sufficient storage for your tiles and
# authorized with your TileMill 0.10.0 install.
# Note that the maximum file transfer size is 5GB.
# Adapted from https://gist.github.com/springmeyer/7875415.
# Settings: edit these as needed
PROJECT_NAME="geography-class" # the folder name in your /project directory
OUTPUT_DIRECTORY="~/Documents/MapBox/export/"

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory

@tmcw
tmcw / hexer.md
Last active December 28, 2015 03:38
Hexer is Cool

hexer is cool. It's a new project by Howard Butler that makes hexagon binned files out of point files.

Building hexer

This worked on my system (OSX 10.9, git via homebrew)

git clone https://github.com/hobu/hexer.git
@ian29
ian29 / macpg.sh
Last active December 21, 2015 22:49
easiest way to install postgres (and postgis) on mac os x
# !/bin/bash
# make sure homebrew is up-to-date and install some stuff
brew update
brew install postgres || brew upgrade postgres
brew install postgis || brew upgrade postgis
# if you dont have brew on your path yet
echo "export PATH=/usr/local/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
@mplewis
mplewis / flask-uwsgi-nginx-primer.md
Last active October 24, 2022 19:20
Flask + uWSGI + nginx Primer. I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

Flask + uWSGI + nginx Primer

I've been having trouble with serving a Flask app via uWSGI and nginx, so I thought I'd put together some of the basics to help out others.

How this shit works

  • Flask is managed by uWSGI.
  • uWSGI talks to nginx.
@celoyd
celoyd / t.py
Last active October 2, 2018 23:36
A simple, mostly-not-mine Twitter stream consumer and s3 bucketer
#!/usr/bin/env python
'''
This code is adapted from the consensus best practice python Twitter feed
consumer that's been floating around for a while now on StackOverflow etc.
My only addition to speak of is TenminWriter. (A "tenmin" is ten minutes
worth of stream. It's just a convenient chunk; you might want to make it
shorter or longer.)
THERE ARE BUGS HERE. THIS IS BARELY TESTED. DO NOT TRUST IT.