I hereby claim:
- I am carlzulauf on github.
- I am carlzulauf (https://keybase.io/carlzulauf) on keybase.
- I have a public key ASBdd9PaBV4nzitPvyoXMfFKb4jFJ-5w8xzBV81Qc-LDywo
To claim this, I am signing this object:
| -- Haversine Formula based geodistance in miles (constant is diameter of Earth in miles) | |
| -- Based on a similar PostgreSQL function found here: https://gist.github.com/831833 | |
| -- Updated to use distance formulas found here: http://www.codecodex.com/wiki/Calculate_distance_between_two_points_on_a_globe | |
| CREATE OR REPLACE FUNCTION public.geodistance(alat double precision, alng double precision, blat double precision, blng double precision) | |
| RETURNS double precision AS | |
| $BODY$ | |
| SELECT asin( | |
| sqrt( | |
| sin(radians($3-$1)/2)^2 + | |
| sin(radians($4-$2)/2)^2 * |
| # Redis configuration file example | |
| # Note on units: when memory size is needed, it is possible to specifiy | |
| # it in the usual form of 1k 5GB 4M and so forth: | |
| # | |
| # 1k => 1000 bytes | |
| # 1kb => 1024 bytes | |
| # 1m => 1000000 bytes | |
| # 1mb => 1024*1024 bytes | |
| # 1g => 1000000000 bytes |
| #!/usr/bin/env ruby | |
| # git clean-local | |
| # --------------- | |
| # Clean out your local branches. Defaults to branches you haven't touched in 30+ days. | |
| # | |
| # More info: git clean-local -h | |
| # | |
| # Asks for confirmation by default, so safe to run with no options. |
| #!/usr/bin/env ruby | |
| # git pushu | |
| # --------- | |
| # | |
| # Push upstream every time | |
| # | |
| # * If the current branch tracks a remote, push to it. | |
| # | |
| # * If there is no tracking branch, point to a branch of the same name, |
| #!/usr/bin/env ruby | |
| # git pullf | |
| # --------- | |
| # Force pull without needing to be verbose | |
| current = `git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)` | |
| remote, remote_branch = current.strip.split("/", 2) | |
| branch = `git branch | grep \\* | cut -d ' ' -f2` |
| #!/usr/bin/env ruby | |
| # Console script with saved data serialized into script body at bottom | |
| # | |
| # `Console#db` is serialized via YAML whenever the `save` method is called | |
| # * YAML is placed after special `__END__` keyword | |
| # * Script can access data after `__END__` via `DATA` constant | |
| # Useful as a skeleton for one-off console scripts needing limited data storage |
| require 'rake' | |
| desc "Install dot files as symbolic links" | |
| task :install do | |
| dots = File.join(Dir.getwd, "home") | |
| home = Dir.home | |
| backup = File.join(home, ".backup-dotfiles") | |
| Dir.mkdir(backup) unless File.directory?(backup) | |
| files = Dir.entries(dots) - [".", ".."] | |
| files.each do |file| |
| require 'logger' | |
| require 'net/http' | |
| require 'json' | |
| require 'mail' # gem 'mail' | |
| dir = File.dirname(__FILE__) | |
| logger = Logger.new(STDOUT) | |
| logger.level = Logger::INFO |
I hereby claim:
To claim this, I am signing this object: