Skip to content

Instantly share code, notes, and snippets.

View delagoya's full-sized avatar

Angel Pizarro delagoya

View GitHub Profile
require 'open-uri'
require 'hpricot'
result = Hpricot.parse(open(ARGV[0]))
STDERR.puts "ERROR: #{ARGV[0]}" unless result.root.name == "html"
class Blat < CloudCrowd::Action
# Run BLAT on the input against a database with some options.
def process
#download the query DB to local disk
query_db = download(options[:db],File.basename(options[:db]))
#run blat search
`blat #{query_db} #{input_path} #{file_name}.result #{option[:args]}`
# gzip the file
`gzip #{file_name}.result`
#save the file to S3 and return the S3 URL as the result a
# assume you have a file with lots if dates
d <- read.delim('datafile.txt')
# plot the values on Y dates on X
plot(d$webhits, type='l', xaxt='n', xlab='', ylab='', xlim=c(1,length(d$date)))
# draw the x axis
date.labels <- d$date[pretty(1:length(d$date),10) + 1 ]
axis(1,at=pretty(1:length(d$date),10),labels=date.labels)
The warm weather has me thinking about prok ribs. Thought I would share my secret sauce, I guess now making it public sauce.
Per rack of baby-back rib:
1 tsp Diced ginger (you know from a jar)
2 big cloves garlic (diced)
1 tbsp Kosher salt
1 tbsp suger
pepper to taste
package mz
{
import flash.filesystem.File;
import flash.filesystem.FileMode;
import flash.filesystem.FileStream;
import flash.utils.Dictionary;
public class MzXml
{
/**
* A random access parser for mzXML files.
@delagoya
delagoya / gitx
Created December 8, 2008 17:04
open GitX on the current dir from cli
#!/bin/sh
/Applications/GitX.app/Contents/MacOS/GitX `pwd` >& /dev/null &
@delagoya
delagoya / README
Created December 8, 2008 14:42
Setting session cookies from flash in Merb
This is Merb middleware to set a session cookie when the request comes from flash.
You must first require the module, then invoke it's use in the call chain in either rack.rb or config.ru.
Examples below. Note that SWFUPload by default adds a lot of post parameters with non-standard
ruby variable names, so merb-action-args will choke a bit on that unless you customize SWFupload
or just not use action-args.
Also note that the session information must be set as a GET parameters, e.g. in the URL request like so:
@delagoya
delagoya / README
Created December 8, 2008 14:27 — forked from mtodd/README
A collection of Rack middleware, found all over the internet and part of Merb's core.
import cherrypy
from cherrypy._cpdispatch import PageHandler, LateParamPageHandler
import routes
import logging
import yaml
REST_METHODS = ('GET','PUT','POST','DELETE')
def is_form_post(environ):
"""Determine whether the request is a POSTed html form"""
@delagoya
delagoya / pause
Created October 10, 2008 17:03
git shell script to "pause" your work (saves branch to remote)
#!/bin/sh -x
CURRENT=`git branch | grep '*' | awk '{print $2}'`
MSG="hitting the pause button"
if [ $# -ne 0 ]; then
MSG="$1"
fi
git add .
git commit -m "${MSG}"
git push origin ${CURRENT}