Skip to content

Instantly share code, notes, and snippets.

View mndoci's full-sized avatar

Deepak Singh mndoci

View GitHub Profile
@mndoci
mndoci / gist:9314
Created September 7, 2008 20:49 — forked from entryway/gist:9313
undefined
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 => "****",
@mndoci
mndoci / gist:9315
Created September 7, 2008 20:51 — forked from mza/gist:8787
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
# 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
# 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 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
# 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
#!/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(' ')
#!/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
# 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]/'
}
#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