Skip to content

Instantly share code, notes, and snippets.

@rochoa
rochoa / ImageMagick 6.6.9-10 Homebrew Formula.md
Last active August 29, 2015 13:58
Homebrew Formula for ImageMagick 6.6.9-10

Homebrew Formula patching old ImageMagick release 6.6.9-10

Install

$ brew install https://gist.githubusercontent.com/rochoa/10006522/raw/9e3ffb85bbc897ec7608b710ce58196d0ee86d43/imagemagick.rb

Tested

@rochoa
rochoa / ant.rb
Created May 30, 2014 14:14
Apache Ant Homebrew Formula with hardcoded URL
require 'formula'
class Ant < Formula
homepage 'http://ant.apache.org/'
url 'http://www.us.apache.org/dist/ant/binaries/apache-ant-1.9.4-bin.tar.gz'
sha1 '6c41481e8201f6b3f7e216146b95bb6de70208bb'
bottle do
cellar :any
sha1 "56eee6f32ab55854b1ccbaa3e106129517e94f7f" => :mavericks
@rochoa
rochoa / Redis 2.6.x Brew Formula.md
Last active August 29, 2015 14:02
Homebrew Formula for Redis 2.6.6
@rochoa
rochoa / Varnish 2.1.x Brew Formula.md
Created June 20, 2014 16:22
Homebrew Formula for Varnish 2.1.5
@rochoa
rochoa / algorithms.js_vs_native_sort.md
Last active August 29, 2015 14:05
native sort vs algorithms quicksort in different node versions

Check the conversation here https://twitter.com/felipernb/status/499661739244281859

As Felipe mentions native sort covers many edge cases so native method is less performant. However I get totally different results using node.js in different versions, check results_node_* files.

Some edge cases, see tests.js file:

  • Sorting [1, null] produces different result in native than in algorithms.js.
  • ['a', null, 'a'] produces inconsistent results in algorithms.js.
@rochoa
rochoa / urlencode
Created December 16, 2014 11:47
urlencode from stdin
#!/usr/bin/python
import sys
import urllib
print urllib.quote_plus(sys.stdin.read())
@rochoa
rochoa / urldecode
Created December 16, 2014 11:48
urldecode from stdin
#!/usr/bin/python
import sys
import urllib
print urllib.unquote_plus(sys.stdin.read())
@rochoa
rochoa / speed.sql
Last active August 29, 2015 14:27 — forked from javisantana/speed.sql
speed from a track table
WITH deltas as (
SELECT
st_distance(the_geom::geography, lag(the_geom::geography, 1) over(order by timestamp)) as ddist,
timestamp - lag(timestamp, 1) over(order by timestamp) as dt
from out_2 offset 1000
)
select avg(ddist/dt) as speed from deltas
@rochoa
rochoa / README.md
Last active September 10, 2015 13:35 — forked from tyrasd/README.md
Map & Globe

modified version of http://bl.ocks.org/curran/01aa2685f083b6c1b9fb with the map's bounding box on the globe

original readme follows:

--

Pan and zoom in the map on the left to rotate the globe.

Click and drag the globe to pan on the map.

@rochoa
rochoa / npm-shrinkwrap-regression.md
Last active November 6, 2015 12:37
npm shrinkwrap regression

There is a regression between versions 1.2.0 and 1.2.1 of npm when generating npm-shrinkwrap.json from >=1.2.1 and using it with <1.2.1

Steps to reproduce

nvm use 0.8.18 # this uses npm@1.2.2 but regression was introduced in npm@1.2.1
npm install
npm shrinkwrap

rm -rf node_modules/