Skip to content

Instantly share code, notes, and snippets.


Carl Zulauf carlzulauf

  • Unabridged Software
  • Denver, CO
View GitHub Profile
View stations-near-me.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
carlzulauf / haversine.sql
Created February 2, 2012 16:47
PostgreSQL function for haversine distance calculation, in miles
View haversine.sql
-- Haversine Formula based geodistance in miles (constant is diameter of Earth in miles)
-- Based on a similar PostgreSQL function found here:
-- Updated to use distance formulas found here:
CREATE OR REPLACE FUNCTION public.geodistance(alat double precision, alng double precision, blat double precision, blng double precision)
RETURNS double precision AS
SELECT asin(
sin(radians($3-$1)/2)^2 +
sin(radians($4-$2)/2)^2 *
carlzulauf / git-clean-local
Last active May 11, 2022 21:43
git clean-local
View git-clean-local
#!/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.
carlzulauf / git-pushu
Created May 11, 2022 21:39
git pushu
View git-pushu
#!/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,
carlzulauf / git-pullf
Created May 11, 2022 21:38
git pullf
View git-pullf
#!/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`
carlzulauf / console_saver.rb
Created March 22, 2022 19:59
A pry session that remembers
View console_saver.rb
#!/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
carlzulauf / redis.conf
Created November 16, 2011 00:45
redis config file for development environment
View redis.conf
# 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
carlzulauf / Rakefile
Created October 5, 2011 17:44
Rake task to install dot files into home directory as symlinks
View Rakefile
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
files = Dir.entries(dots) - [".", ".."]
files.each do |file|
carlzulauf / watch.rb
Created November 14, 2013 08:29
Watch the price of Bitcoin on Coinbase, and alert me.
View watch.rb
require 'logger'
require 'net/http'
require 'json'
require 'mail' # gem 'mail'
dir = File.dirname(__FILE__)
logger =
logger.level = Logger::INFO

Keybase proof

I hereby claim:

  • I am carlzulauf on github.
  • I am carlzulauf ( on keybase.
  • I have a public key ASBdd9PaBV4nzitPvyoXMfFKb4jFJ-5w8xzBV81Qc-LDywo

To claim this, I am signing this object: