Skip to content

Instantly share code, notes, and snippets.

View kzfm's full-sized avatar
🏠
Working from home

Kazufumi Ohkawa kzfm

🏠
Working from home
View GitHub Profile
@kzfm
kzfm / ML130727
Created July 27, 2013 03:48
今日のコード
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)
@kzfm
kzfm / 130824_ML_9
Created August 24, 2013 01:43
入門機械学習読書会9章 MDS
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 / gist:f0fa3ec38c3f82ff2021
Created February 25, 2016 05:55
draget ver0.0
#/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)
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'
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)
;;; ロードパスの追加
(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
@kzfm
kzfm / recap.py
Created August 20, 2012 08:19 — forked from anonymous/recap.py
import openbabel
# Copyright 2009 TJ O'Donnell
class recap:
# RECAP-Retrosynthetic Combinatorial Analysis Procedure
# J. Chem. Inf. Comput. Sci. 1998, 38, 511-522
def __init__(self, mol, minsize=5):
self.mol = mol;
# minimum allowed size (atom count) of fragment
self.minsize = minsize;
# bonded atom pairs populated by the apply method,