Skip to content

Instantly share code, notes, and snippets.

@vangberg
vangberg / todo
Created September 7, 2008 19:37
Best To-Do List. Ever.
#!/bin/sh
# Best To-Do List. Ever.
#
# Usage:
# 1. Add a new item to list: `todo This needs to be fixed`
# 2. Edit the to-do list: `todo -e`
# 3. Show the current to-do's: `todo`
if [[ $1 ]]; then
if [ $1 = "-e" ]; then

Why Git Media

Git does not deal well with bunches of huge binary files, for a few reasons. It kills memory to add and commit them, it is pretty inefficient to transfer them, and it basically forces you to download all of them with each clone.

I thought sparse and narrow checkouts would be the answer, but it looks like it may be too difficult to rewrite other tools to deal with the missing blobs before they are fetched, as well as it still taking server resources to transfer them.

Perhaps a better way would be to hack the Git client slightly to store binary files over a certain size via a protocol that is better for that, like SFTP or HTTP over S3, and then fetch them only when necessary. Instead of the whole blob, just keep a blob that contains a pointer to the URL and SHA of the original content, or possibly just a SHA of the original content, since we could probably depend on the URL being guessable.

This is actually relatively similar to how git submodules does it - not ke

@sr
sr / gist:91275
Created April 7, 2009 15:07
Hax integrity to refresh the page
#!/usr/bin/env ruby
require "rubygems"
require "integrity"
class Refresher
JS = <<-EOS
<script type="text/javascript">
//<![CDATA[
setTimeout('location.reload()', %s * 1000)
//]]>
@sr
sr / gist:108184
Created May 7, 2009 16:08
Crazy test/unit + rack/test hax
require "test/unit"
require "rack/test"
require "contest"
require "sinatra/base"
class MyApp < Sinatra::Base
set :environment, :test
get "/" do
"Hi, #{params["name"]}."
@sr
sr / Markdown in awk(1)
Created May 21, 2009 14:14
Markdown in awk(1)
#!/bin/awk -f
# md2html.awk
# by: Jesus Galan (yiyus) <yiyu.jgl@gmail>, May 2009
# Usage:
# md2html file.md > file.html
# Options: -v esc=false to not escape html
function newblock(nblock){
if(text)
@gabe
gabe / gist:137356
Created June 28, 2009 19:56
Routing & URI generation using URI Templates in Sinatra
require 'addressable/template'
module Juxt
module Sinatra
# Allows for declared, named URI Templates in Sinatra applications,
# for both routing and URI generation.
#
# The URI generation method (included as a Sinatra helper) modifies
# the path of generated URIs with request.script_name, meaning the
# URIs generated will still be valid if multiple Sinatra applications
@bitbckt
bitbckt / resque.rb
Created January 20, 2010 21:32
munin plugin for resque
#!/usr/bin/env ruby
require 'rubygems'
require 'resque'
HOST = ENV['host'] ? ENV['host'] : '127.0.0.1'
PORT = ENV['port'] ? ENV['port'] : '6379'
Resque.redis = "#{HOST}:#{PORT}"
@vangberg
vangberg / DWM-ON-OS-X.md
Created February 22, 2010 19:24
dwm on os x [work in progress!]

Installing and configuring dwm on OS X

  1. Install XQuartz (http://xquartz.macosforge.org) which is the development version of the X11.app that ships with OS X, which means it is way more up to date. I have had some weird issues with X11.app v. 2.3-something. XQuartz 2.5.0 fixed that.

  2. Install dwm from Homebrew, brew install dwm. This makes a bunch of necessary tweaks to the DWM configuration.

  3. Add the following script to $PATH, name it dwm-launch and chmod 755:

    cd ~
    

while true

2 Pac - Tradin War Stories
2 Pac - Holla At Me
50 Cent - Patiently Waiting
50 Cent - Heat
50 Cent - Back Down
50 Cent - Da Repercussions
50 Cent - Power Of The Dollar
G-Unit - Straight Outta Southside
G-Unit - Beg For Mercy
G-Unit - Gangsta Shit
build:
@echo "Combining files ..."
@cat \
js/dep/jquery.easing.js \
js/dep/jquery.jsonp.js \
js/dep/json2.js \
js/dep/toolbox.expose.js \
js/lib/jquery.transloadit2.js > build/jquery.transloadit2.js
@echo "Compiling with Closure REST API ..."
@curl \