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" | |
"github.com/codegangsta/cli" | |
"github.com/toashd/gopher" | |
"os" | |
"time" | |
) |
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 tweepy | |
consumer_key = "hoge" | |
consumer_secret = "hogehoge" | |
access_key = "piyo" | |
access_secret = "piyopiyo" | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth.set_access_token(access_key, access_secret) | |
api = tweepy.API(auth_handler=auth) | |
api.update_status(status="!") |
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
let lines = | |
Seq.initInfinite (fun _ -> System.Console.In.ReadLine()) | |
|> Seq.takeWhile(fun line -> line <> null) | |
|> Seq.toList;; | |
let rec filtered lines = | |
match lines with | |
| [] -> [] | |
| x::res -> | |
if System.String.Equals(x, "42", System.StringComparison.CurrentCultureIgnoreCase) then [] |
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
#include<iostream> | |
#include<vector> | |
#include<algorithm> | |
using namespace std; | |
typedef vector<int> Array; | |
int main(void) { | |
Array limit; | |
int d; | |
while (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
import binascii | |
import struct | |
file = "binary_file" | |
f = open(file, "rb") | |
buf = f.read(8) #^@^@^@^@^@^@^@^@ | |
print(binascii.b2a_hex(buf)) #3bf50f0eb696493f | |
print(struct.unpack('<d', buf)) #0.000780905622491 | |
f.close() |
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
ggboxscaled <- function(ofile, data, ...) { | |
require(ggplot2) | |
require(reshape) | |
tdata <- data.frame(t(rbind(c(0:(dim(data)[2]-1)), data))) | |
tdata <- melt.data.frame(tdata,id.vars="X1",variable_name="temp") | |
tdata$X1 <- as.character(tdata$X1) | |
g <- ggplot(tdata, aes(x = X1, y = value)) | |
g <- g + geom_boxplot() | |
g <- g + ylab("hoge") | |
meate <- as.character(c(0:(dim(data)[2]-1))*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
# a := matrix の各カラムのヒストグラムを同じ幅で描く | |
width = 1 | |
for (i in 1:dim(a)[1]) { | |
plot(hist(a[,i], breaks=seq(min(a[,i]), max(a[,i])+width, width))) | |
} | |
# max(a[,i])だけだとmax(a[,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
ggbox <- function(ofile, data, ...) { | |
require(ggplot2) | |
require(reshape) | |
tdata <- data.frame(t(rbind(c(0:(dim(data)[2]-1)), data))) | |
tdata <- melt.data.frame(tdata,id.vars="X1",variable_name="temp") | |
tdata$X1 <- factor(tdata$X1, levels = c(0:(dim(data)[2]-1)), ordered = TRUE) | |
g <- ggplot(tdata, aes(x = X1, y = value)) | |
g <- g + geom_boxplot() | |
g <- g + ylab("hoge") | |
png(ofile) |
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 random | |
def set(a, b): | |
print "before a", a | |
print "before b", b | |
for i in range(len(a)): | |
next = b[i] | |
prev = i | |
tmp = a[prev] |
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
char CapitalRNA(char c) | |
{ | |
if (c == '$') return c; | |
c = toupper(c); | |
switch(c) { | |
case 'A': case 'C': case 'G': case'U': case 'N': return c; | |
case 'T': case 'K': case 'Y': case 'B': return 'U'; | |
case 'W': case 'R': case 'M': | |
case 'H': case 'V': case 'D': return 'A'; | |
case 'S': return 'C'; |
NewerOlder