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
library(readxl) | |
library(dplyr) | |
ARDS_COMPARE <- read_excel("D:/Desktop/ARDS_COMPARE.xlsx") | |
colnames(ARDS_COMPARE) <- c("compare", "number", "gene", "snp", "minor_allele_1", "major_allele_1", "minor_allele_2", "major_allele_2") | |
d <- ARDS_COMPARE %>% select(minor_allele_1, major_allele_1, minor_allele_2, major_allele_2) | |
d$minor_allele_1 = as.integer(d$minor_allele_1) | |
d$major_allele_1 = as.integer(d$major_allele_1) | |
d$minor_allele_2 = as.integer(d$minor_allele_2) |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
println("hello world!") |
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
#!/bin/bash | |
usage () | |
{ | |
echo Parallel sort | |
echo usage: psort file1 file2 | |
echo Sorts text file file1 and stores the output in file2 | |
} | |
# test if we have two arguments on the command line |
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 MySQLdb | |
class DummyDict(object): | |
def __init__(self, database="test", user="liuwei", password="123456"): | |
self.database = MySQLdb.connect("localhost", user, password, database) | |
self.db = self.database.cursor() | |
self.db.execute("DROP TABLE IF EXISTS test") | |
self.db.execute("CREATE TABLE test (name VARCHAR(255) PRIMARY KEY, content VARCHAR(255))") | |
self.database.commit() | |
def __getitem__(self, key): | |
self.db.execute("SELECT content FROM test WHERE name = %s", (key, )) |
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 sqlite3 | |
class DummyDict(object): | |
def __init__(self, database="database.db"): | |
self.database = sqlite3.connect(database) | |
self.db = self.database.cursor() | |
self.db.execute("DROP TABLE IF EXISTS test") | |
self.db.execute("CREATE TABLE test (name VARCHAR(255) PRIMARY KEY, content VARCHAR(255))") | |
def __getitem__(self, key): | |
self.db.execute("SELECT content FROM test WHERE name = ?", (key, )) | |
return self.db.fetchone()[0] |
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
libraryDependencies <+= sbtVersion(v => v match { | |
case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8" | |
case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10" | |
case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11" | |
case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1" | |
case x if (x.startsWith("0.12")) => "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-0.2.11.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
name := "lift-demo" | |
scalaVersion := "2.9.2" | |
seq(webSettings :_*) | |
// enable jrebel | |
scanDirectories in Compile := Nil | |
resolvers += "Java.net Maven2 Repository" at "http://download.java.net/maven/2/" |
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
ARGF.readlines.inject(Hash.new(0)){ |h,l| h[l.chomp.split[1]] += 1;h}.sort.last(10) |