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 gaston.py
import openbabel as ob
import os.path,sys,re
from tempfile import mkstemp
def to_gasfile(input,type="sdf"):
""" convert file to gaston format"""
(n,gastonfile) = mkstemp()
f = open(gastonfile, 'w')
View gamess.py
import openbabel as ob
from tempfile import mkstemp, mkdtemp
from os import removedirs, unlink, system, environ
import re
import os.path
import string
from random import choice
def randstr(n):
"""ランダムなファイル名を生成するため"""
@kzfm
kzfm / table.html
Created Dec 4, 2011
HTML5 table sample
View table.html
<table>
<tr>
<th>Item</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
</tr>
<tr>
<td>Coffee mug</td>
<td>$10.00</td>
@kzfm
kzfm / jqmtweet.jade
Created Mar 20, 2012
jQuery Mobile Tweet
View jqmtweet.jade
!!! 5
html
head
title jqm Tweet
link(rel="stylesheet", href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css")
script(src="http://code.jquery.com/jquery-1.7.1.min.js")
script(src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js")
meta(name="viewport", content="width=device-width, initial-scale=1")
meta(charset="UTF-8")
style
View gist:2318538
$ ->
Todo = Backbone.Model.extend(
defaults: ->
title: "empty todo..."
order: Todos.nextOrder()
done: false
initialize: ->
@set title: @defaults.title unless @get("title")
@kzfm
kzfm / googlemaptest.html
Created May 10, 2012
googlemapsでクリックするとtwittericonでマーカーが設置されるサンプル
View googlemaptest.html
<!DOCTYPE html><html><head><script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script><link rel="stylesheet" href="style.css"><script>var map;
function initialize() {
var myLatlng = new google.maps.LatLng(35.360556,138.727778);
var myOptions = {
zoom: 11,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
@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"
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)
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
}
You can’t perform that action at this time.