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
# Very simple tk application to save progress on Microprose's Risk II game | |
# (written many years ago) | |
# | |
# Create a bat file to run, like this: | |
# ----save_risk.bat---- | |
# c:\cygwin\bin\rubyw /home/john/risk2_saver.rb c:/Users/john/Desktop/RISK_SAVES | |
require 'Win32API' | |
require 'fileutils' | |
require 'tk' |
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/env ruby | |
require 'open-uri' | |
require 'mspire/digester' # gem install mspire | |
require 'bio' | |
require 'set' | |
accessions = ARGV[0,2] | |
missed_cleavages = ARGV[2].to_i |
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
# do what the heck you want to public license (see doc end) | |
# gem install ruby-svg # provides SVDMatrix | |
require 'ruby-svd' | |
class SVDMatrix < Matrix | |
def self.[](*rows) | |
mat = self.new(rows.size,rows.first.size) | |
rows.each_with_index {|row,i| mat.set_row(i, row) } | |
mat |
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/env ruby | |
# requires rb-inotify (will only work on linux) | |
require 'rb-inotify' | |
substitute = '{{}}' | |
div = '--' | |
if ARGV.size < 2 | |
prog = File.basename(__FILE__) |
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
# https://gist.github.com/gists/2897543 | |
# NilEnumerator | |
# | |
# an enumerator that yields nil when it is finished. Only implements #next and | |
# #peak. Would only want to use this if your collection does NOT already include | |
# nils. | |
# | |
# Compare: | |
# | |
# # normal iteration requires catching StopIteration |
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 'spec/more' | |
require 'digestor' | |
describe "Digestor" do | |
before do | |
@seq = "MTMDKSELVQKAKLAEQAERYDDMAAAMKAVTEQGHELSNEERNLLSVAYKNVVGARRSSWRVISSIEQKTERNEKKQQMGKEYREKIEAELQDICNDVLELLDKYLIPNATQPESKVFYLKMKGDYFRYLSEVASGDNKQTTVSNSQQAYQEAFEISKKEMQPTHPIRLGLALNFSVFYYEILNSPEKACSLAKTAFDEAIAELDTLNEESYKDSTLIMQLLRDNLTLWTSENQGDEGDAGEGEN" | |
end | |
it 'digests a protein' do |
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 'mechanize' | |
class LDSGeneralConferenceURLFinder | |
MONTH_TO_NUM = { | |
'April' => 4, | |
'October' => 10, | |
} | |
LDS_ORG = "http://www.lds.org" | |
TOC_URL = "http://www.lds.org/conference/display/0,5234,23-1,00.html" |
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 'builder' | |
if ARGV.size == 0 | |
puts "usage: #{File.basename(__FILE__)} <input>.xml ..." | |
puts "output: <input>.result.xml ..." | |
exit | |
end | |
ARGV.each do |file| | |
File.open(file.sub(/\.xml/,'.result.xml'), 'w') do |out| |
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
import scipy.stats as sts | |
from math import log | |
def fisher_combine_p_values(pvalues): | |
degrees_freedom = 2*len(pvalues) | |
summed = sum(-2*log(pval) for pval in pvalues) | |
return 1.0 - sts.chi2.cdf(summed, degrees_freedom) | |
#print(fisher_combine_p_values( [0.05, 0.05] )) |
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
# for syslinux, you want something like this: | |
APPEND root=/dev/sda2 rw vga=current quiet loglevel=0 | |
# OR | |
APPEND root=/dev/sda2 rw vga=865 quiet loglevel=0 | |
# edit the files systemd-fsck-root.service and systemd-fsck@.service located at /usr/lib/systemd/system/ to configure StandardOutput and StandardError like this: | |
(...) | |
[Service] | |
Type=oneshot |