Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Kazufumi Ohkawa kzfm

🏠
Working from home
Block or report user

Report or block kzfm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:07a1d425765629ccc00649dc4147b618
;;; ロードパスの追加
(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
View gist:2337620e5285149d106961fe1269cd9c
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)
View gist:500271571ae458a8e6993a1f68f149d6
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'
View gist:f0fa3ec38c3f82ff2021
#/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)
@kzfm
kzfm / 130824_ML_9
Created Aug 24, 2013
入門機械学習読書会9章 MDS
View 130824_ML_9
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
@kzfm
kzfm / ML130727
Created Jul 27, 2013
今日のコード
View ML130727
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)
View gist:5836232
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
}
View gist:5472037
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)
@kzfm
kzfm / sample.el
Created Nov 24, 2012
sample_init.el
View sample.el
;;; 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とする
@kzfm
kzfm / hasflymake
Created Nov 24, 2012
haskell-flymake
View hasflymake
(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"
You can’t perform that action at this time.