This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require_gem 'activerecord' | |
require '/var/www/hoosier/app/models/payment_method' | |
#Connect to the database | |
ActiveRecord::Base.establish_connection( | |
:adapter => "postgresql", | |
:host => "localhost", | |
:username => "****", | |
:password => "****", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Task: Protein lookup | |
Find protein structure for 1MBN | |
From PDB | |
Return sequence of protein | |
Task: Blast | |
Run BLAST | |
Using the protein sequence from Protein lookup task | |
On uniprot | |
Select all hits with e < 0.00001 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From Euan's blog post | |
# http://www.ghastlyfop.com/blog/2008/12/strip-html-tags-from-string-ruby.html | |
require 'hpricot' | |
page = Hpricot("<b>some marked up <i>text</i></b>") | |
puts page.to_plain_text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Crossref Ruby oneliner | |
# From http://www.crossref.org/CrossTech/2008/12/and_the_doi_is.html | |
ruby -rubygems -e 'require "mini_exiftool"; | |
puts MiniExiftool.new("test.pdf")["doi"]' | |
10.1038/nphoton.2008.200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a simple command line tool for uploading | |
# and folders of files to AWS S3. You must first | |
# create a vaild bucket to upload to. | |
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'pathname' | |
require 'aws/s3' | |
include AWS::S3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Chemcaster example | |
require 'rubygems' | |
require 'activeresource' | |
class Structure < ActiveResource::Base | |
self.site = 'http://chemcaster.com/collections/:collection_id' | |
self.user = '[email protected]' | |
self.password = 'secret' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# save as pubmed.rb and test using 'ruby pubmed.rb 19662644' | |
# keyword search may return > 1 record due to retmax bug | |
# http://github.com/bioruby/bioruby/commit/51c3223e033b2992a7bd95da282f88164406ff92 | |
# From Neil Saunders http://gist.github.com/164994 | |
require 'rubygems' | |
require 'bio' | |
keywords = ARGV.join(' ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin ruby | |
# From Paulo Nuin | |
# Source: http://ruby.genedrift.org/?p=18 | |
require 'rubygems' | |
require 'bio' | |
my_file = File.new(ARGV[0]) | |
refs = my_file.readlines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you use osx terminal/git this includes a couple nice features: | |
# 1) Minimalist colors | |
# 2) Stripped down CLEAN prompt | |
# 3) For GIT folders it will display the current branch. | |
# To install just copy this into the top of your ~/.bash_profile | |
# Based on http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#SWITCHES | |
#-d (cap deploy when check-in finished) | |
#-v (verbose, defaults to quiet) | |
#-m "commit message" (custom commit message) | |
#!/bin/bash | |
## options to be accepted | |
optstr=m:dv ## colon follows options that require an argument | |
while getopts $optstr var | |
do |
OlderNewer