Skip to content

Instantly share code, notes, and snippets.

@1kastner
1kastner / map matching with jupyter.ipynb
Last active January 4, 2019 14:20
map matching with jupyter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ryandotsmith
ryandotsmith / s_queue.rb
Last active August 29, 2015 14:07
Multi-threaded SQS Ruby Worker. I have tests. Maybe this is a gem? Lemme know if you find it useful.
require 'aws-sdk'
require 'json'
module SQSW
class SQueue
MissingQueue = Class.new(StandardError)
def initialize(url = nil)
raise(MissingQueue, "Missing queue_url") if url.nil?
@q = find_queue(url)

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file:

@davidcelis
davidcelis / 1.9.3-p362-perf.md
Last active October 17, 2016 11:28 — forked from burke/0-readme.md
Ruby 1.9.3-p362 cumulative performance patch for rbenv

NOTE: THIS PATCH DOES NOT APPLY. Falcon's performance patches have not been updated for p362. See the comments for a fork that uses the Rails Express patch set instead.

ruby-1.9.3-p362 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p362 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

@TheRayTracer
TheRayTracer / QuickSort.txt
Created March 21, 2012 07:23
A sample proof-of-concept quick sort implementation to compare the importance of selecting a quality pivot. This implementation uses C++ and the STL. Comments have been removed before posting.
2148
9058
7742
3153
6324
609
7628
5469
7017
504
@dblock
dblock / api_page_helper.rb
Created November 2, 2011 23:08
pagination helper with Grape
module ApiPageHelper
PAGINATE_OPTIONS = {
:default_page_size => 10
}
PAGINATE_PARAMS = [ "page", "offset", "size" ]
def paginate(coll, options = {})
options = PAGINATE_OPTIONS.merge(options)
if params[:page]
page = params[:page].to_i
size = (params[:size] || options[:default_page_size]).to_i
@weavejester
weavejester / gist:1001206
Created May 31, 2011 20:27
Clojure on Heroku
~/$ lein new ring-on-heroku
Created new project in: /home/jim/Development/ring-on-heroku
~/$ cd ring-on-heroku
~/ring-on-heroku$ echo 'web: lein run -m ring-on-heroku.core' > Procfile
~/ring-on-heroku$ cat > src/ring_on_heroku/core.clj
(ns ring-on-heroku.core
(:use ring.util.response
ring.adapter.jetty))
(defn app [req]
@gavinheavyside
gavinheavyside / Create PostGIS template
Last active October 30, 2018 10:36
Create a POSTGIS template database
-- From http://geospatial.nomad-labs.com/2006/12/24/postgis-template-database/
-- $ sudo su postgres
-- $ psql template1
\c template1
CREATE DATABASE template_postgis WITH template = template1;
-- set the 'datistemplate' record in the 'pg_database' table for
-- 'template_postgis' to TRUE indicating its a template
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis';