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
# Hello, and welcome to makefile basics. | |
# | |
# You will learn why `make` is so great, and why, despite its "weird" syntax, | |
# it is actually a highly expressive, efficient, and powerful way to build | |
# programs. | |
# | |
# Once you're done here, go to | |
# http://www.gnu.org/software/make/manual/make.html | |
# to learn SOOOO much more. |
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
var system = require('system'); | |
var page = require('webpage').create(); | |
page.open(system.args[1], function() | |
{ | |
console.log(page.content); | |
phantom.exit(); | |
}); |
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
package main | |
import ( | |
"fmt" | |
) | |
type IntGenerator struct { | |
Chan chan int | |
n int | |
} |
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 python | |
import argparse | |
import random | |
parser = argparse.ArgumentParser(description="generate test data", | |
epilog="https://github.com/shenwei356/") | |
parser.add_argument('-n', | |
type=int, | |
default=700000, | |
help='number of query list') |
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
// run: | |
// | |
// go test -test.bench="." -test.cpuprofile=prof.out | |
// go tool pprof ./gist.test prof.out | |
package main | |
import ( | |
"bytes" | |
"testing" | |
) |
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
scaf001 glean mRNA 20 30 0.4 - . somestring | |
scaf001 glean CDS 30 50 . + 0 asdfasd | |
scaf003 glean CDS 10 25 0.4 - . somestring |
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/python | |
import re | |
from itertools import groupby | |
s = '11M1D31M1I3M1D48M2I1M1D28M' | |
g = re.findall('\d+[A-Z]', s) # ['11M', '1D', '31M', '1I', '3M', '1D', '48M', '2I', '1M', '1D', '28M'] | |
kv = [[x[-1], int(x[0:-1])] for x in g] # [['M', 11], ['D', 1], ['M', 31], ['I', 1], ['M', 3], ['D', 1], ['M', 48], ['I', 2], ['M', 1], ['D', 1], ['M', 28]] | |
kv = sorted(kv, key=lambda e: e[0]) # fuck !! sorting needed! | |
stat = { k: sum((g[1] for g in group)) for k, group in groupby(kv, key=lambda e: e[0])} | |
print(stat) # {'M': 122, 'I': 3, 'D': 3} |
NewerOlder