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
;;; ロードパスの追加 | |
(setq load-path (append | |
'("~/.emacs.d" | |
"~/.emacs.d/packages/emacs-jedi" | |
G "~/.emacs.d/packages/json-mode" | |
"~/.emacs.d/auto-install" | |
"~/.emacs.d/conf") | |
load-path)) | |
;;; packages.el |
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
from selenium import webdriver | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
from selenium.webdriver.common.keys import Keys | |
from selenium.common.exceptions import WebDriverException | |
driver = webdriver.Chrome("/Users/kzfm/chromedriver") | |
url = "https://www.release.tdnet.info/index.html" | |
driver.get(url) | |
iframe = driver.find_element_by_tag_name("iframe") | |
driver.switch_to_frame(iframe) |
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
from selenium import webdriver | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
from selenium.webdriver.common.keys import Keys | |
from selenium.common.exceptions import WebDriverException | |
dcap = dict(DesiredCapabilities.PHANTOMJS) | |
dcap["phantomjs.page.settings.userAgent"] = ("Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.2; .NET4.0E)") | |
service_args = [ | |
'--ssl-protocol=tlsv1' |
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/env python | |
import requests | |
import sys | |
from pyquery import PyQuery as pq | |
def get_result(acc): | |
r = requests.get("http://trace.ddbj.nig.ac.jp/DRASearch/run?acc={}".format(acc)) | |
d =pq(r.content) |
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
set.seed(851982) | |
ex.matrix <- matrix(sample(c(-1, 0, 1), 24, replace = TRUE), | |
nrow = 4, | |
ncol = 6) | |
row.names(ex.matrix) <- c('A', 'B', 'C', 'D') | |
colnames(ex.matrix) <- c('P1', 'P2', 'P3', 'P4', 'P5', 'P6') | |
ex.matrix | |
ex.mult <- ex.matrix %*% t(ex.matrix) | |
ex.mult |
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(ggplot2) | |
library(gridExtra) | |
### | |
set.seed(1) | |
x <-seq(-10, 10, by=0.01) | |
y <- 1 - x ^ 2 + rnorm(length(x), 0, 5) | |
g1 <- ggplot(data.frame(X=x,Y=y), aes(x=X, y=Y))+ geom_point() + geom_smooth(se = FALSE) | |
g2 <- ggplot(data.frame(X=x,Y=y), aes(x=X, y=Y))+ geom_point() + geom_smooth(method='lm', se=FALSE) |
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
gx <- function(x){ | |
x[-2>x | x>2] <-NA | |
1/2*cos(6*x)+7/2 | |
} | |
fx <- function(x){ | |
x[x<(-1)] <- NA | |
x[x>1] <- NA | |
x^4-x^2+6 | |
} |
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
setwd("/Users/kzfm/lang/rcode/ML_for_Hackers/01-Introduction/") | |
ufo <- read.delim("data/ufo/ufo_awesome.tsv", sep="\t", stringsAsFactors=FALSE, header=FALSE, na.strings="") | |
names(ufo) <- c("DateOccurred", "DateReported", "Location", "ShortDescription", "Duration", "LongDescription") | |
good.rows <- ifelse(nchar(ufo$DateOccurred) !=8 | nchar(ufo$DateReported) !=8, FALSE, TRUE) | |
ufo <- ufo[good.rows,] | |
ufo$DateOccurred <- as.Date(ufo$DateOccurred, format="%Y%m%d") | |
ufo$DateReported <- as.Date(ufo$DateReported, format="%Y%m%d") | |
get.location <- function(l) { | |
split.location <- tryCatch(strsplit(l,",")[[1]], error= function(e) return(c(NA, NA))) | |
clean.location <- gsub("^ ", "", split.location) |
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
;;; packages.el | |
(require 'package) | |
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) | |
(package-initialize) | |
; 言語を日本語にする | |
(set-language-environment 'Japanese) | |
; 極力UTF-8とする |
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
(autoload 'ghc-init "ghc" nil t) | |
(add-hook 'haskell-mode-hook '(lambda () | |
(ghc-init) | |
(local-set-key "\C-j" (lambda () (interactive)(insert " -> "))) | |
(local-set-key "\M-j" (lambda () (interactive)(insert " => "))) | |
(local-set-key "\C-l" (lambda ()(interactive)(insert " <- "))) | |
)) | |
(defadvice inferior-haskell-load-file (after change-focus-after-load) | |
"Change focus to GHCi window after C-c C-l command" |
NewerOlder