This file contains hidden or 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/env ruby | |
# | |
# Wubin Qu <[email protected]> | |
# | |
if ARGV.size != 1 | |
$stderr.puts " | |
Remove blank lines and leading ^M characters | |
Usage: |
This file contains hidden or 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/env ruby | |
# | |
# Wubin Qu <[email protected]> | |
require 'fileutils' | |
module Biodb | |
module DbProcess | |
attr_reader :ftp_address, :dir | |
attr_accessor :available_dbs |
This file contains hidden or 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/env ruby | |
ARGV[1..-1].each do |file| | |
puts file | |
`#{ARGV[0]} #{file}` | |
end | |
# Example | |
# ./batch_run.rb "tar zxvf" refseq_genomic.*.gz |
This file contains hidden or 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
# It works for pure text only. It will fail for html and url type of text. | |
# http://henrik.nyh.se/2007/03/ruby-wordwrap-method | |
def wrap_long_string(text,max_width = 20, separator = "\n") | |
(text.length < max_width) ? | |
text : | |
text.scan(/.{1,#{max_width}}/).join(separator) | |
end |
This file contains hidden or 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
# -*- encoding: utf-8 -*- | |
require 'mini_magick' | |
require 'rtesseract' | |
require 'nokogiri' | |
require 'nestful' | |
require 'csv' | |
require 'pp' | |
class Buy360 | |
def initialize(url='') |
This file contains hidden or 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
// Settings in here override those in "Default/Preferences.sublime-settings", and | |
// are overridden in turn by file type specific settings. | |
{ | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"default_line_ending": "unix", | |
"highlight_line": true, | |
"word_wrap": "true", | |
"font_size": 12 | |
} |
This file contains hidden or 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 'bio' | |
# Input is abstract file in Medline format. | |
year_count = Hash.new(0) | |
File.read(ARGV[0]).split("\n\n").each do |article_block| | |
article = Bio::MEDLINE.new(article_block) | |
year_count[article.year] += 1 | |
end | |
year_count.each do |year, count| | |
puts "#{year}, #{count}" |
This file contains hidden or 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/python | |
# Author: Wubin Qu <[email protected]> | |
# Tue Jan 28 23:17:08 2014 | |
import platform | |
import subprocess | |
import re | |
def get_free_memory(): |
This file contains hidden or 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
#!/home/zhangcg/local/python/bin/python | |
# -*- coding:utf-8 -*- | |
#----------------------------------------------------- | |
# File: CairoNumberWidth.py | |
# Date: 2008-07-04 | |
# Description: | |
#----------------------------------------------------- | |
__version__ = '1.0' |
This file contains hidden or 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/env ruby | |
Dir.foreach('./') do |dir| | |
next unless File.directory?(dir) | |
next if ['.', '..'].include?(dir) | |
if Dir.entries(dir) == ['.', '..'] | |
Dir.delete(dir) | |
end | |
end |
OlderNewer