Skip to content

Instantly share code, notes, and snippets.

@hernan43
hernan43 / http.go
Created May 27, 2011 10:27
Just pasted this in gist so I could print it up all colorized.
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// On App Engine, the framework sets up main; we should be a different package.
package moustachio
import (
"bytes"
"fmt"
@hernan43
hernan43 / Makefile
Created May 26, 2011 13:54
My first Go application. A URL "shortener". Doesn't really shorten as good as a real one, but it served as a good test.
include $(GOROOT)/src/Make.inc
TARG=gourl
O_FILES = gourl.6
all:
make clean
make $(TARG)
.mouse{
position: absolute;
background-image: url('../images/cursor.png');
width: 15px;
height: 22px;
z-index: 100;
}
#!/usr/bin/env ruby
require 'rubygems'
require 'cgi'
require 'pp'
require 'mime/types'
def mime_type(file)
case
when file =~ /\.jpg/ then 'image/jpg'
when file =~ /\.gif$/ then 'image/gif'
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<%= javascript_include_tag :defaults %>
<%= stylesheet_link_tag("site") %>
#!/bin/bash
export PSXDIR=$HOME/psx
if [ $1 -z -o $2 -n ];
then
echo "\nERROR: Invalid usage.\n"
echo "\n Usage: psxrip [filename]\n"
echo "\n where filename is the desired name, minus extensions.\n"
fi
cd /usr/bin
./cdrdao read-cd --read-raw --datafile $PSXDIR/$1.bin --device 0,0,0 --driver generic-mmc-raw $PSXDIR/$1.cue
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
#!/usr/bin/env ruby
#
# usage: tweets_to_csv.rb <search term> <output filename>
#
#
# This is the 'dumb' approach
# needs reworking if you want something that handles duplicates and whatnot
require 'rubygems'
require 'csv'
#!/usr/bin/env ruby
# This script performs an OAuth authorized POST with multipart encoding to
# http://twitter.com/account/update_profile_image.json
#
# This code is primarily taken from my Grackle library's implementation at
# http://github.com/hayesdavis/grackle
#
# RUNNING THIS WILL CHANGE AN ACCOUNT'S PROFILE IMAGE. BE CAREFUL.
#