Skip to content

Instantly share code, notes, and snippets.

View fanannan's full-sized avatar

SAWADA Takahiro / Gugen Koubou LLC fanannan

  • Gugen Koubou LLC
  • Tokyo, Japan
View GitHub Profile
@fanannan
fanannan / user.keymap
Last active January 2, 2016 15:49
my user.keymap for lighttable 0.6.0 as of 2014-01-09
{:+ {:app {
;"pmeta-alt-]" [:tabset.next]
;"pmeta-alt-[" [:tabset.prev]
;"pmeta-alt-n" [:tabset.new]
;"pmeta-alt-w" [:tabset.close]
;"pmeta-shift-f" [:window.fullscreen]
"pmeta-alt-f" [:searcher.show]
"pmeta-f" [:find.fill-selection :find.show]}
:editor {"alt-w" [:editor.watch.watch-selection]
(ns schema-test.core
(:require
; Schema
[schema.core :as s] ; 型チェック関係
[schema.macros :as sm] ; 定義用マクロなど
))
;;
;; validate, check
;;
@fanannan
fanannan / schama
Last active August 29, 2015 13:57
Schemaの紹介
Schemaとは
・Prismatic社製の型チェックライブラリ
・最新版は “0.2.1”
https://github.com/prismatic/schema
@fanannan
fanannan / SCW.clj
Last active August 29, 2015 14:01
A trial implementation of SCW (Soft Confidence Weighted Learning)
; SCW Classifier
;
; This is a straightforward and an experimental implementation of SCW by fanannan _at_ forestwinds.com, based on "Exact Soft Confidence-Weighted Learning" by J Wang, P Zhao and S C H Hoi, 2012.
; Full covariance matrix is used for sigma so that this may run slowly with high dimensional data.
(ns wagtail.scw
(:require [clatrix.core :as cl])
(:import [org.apache.commons.math3.special Erf]))
(defn probit [p]
@fanannan
fanannan / ndl.clj
Last active August 29, 2015 14:03
Yomigana fetcher of an author registered at the National Diet Library of Japan
; fetch yomigana of an author registered at the National Diet Library of Japan
(ns ndl.core
(:use [clojure.data.json :as json]
[ring.util.codec :only [url-encode]]
[clj-http.client :as client]))
(defn make-query-string [m & [encoding]]
(let [s #(if (instance? clojure.lang.Named %) (name %) %)
enc (or encoding "UTF-8")]
@fanannan
fanannan / twitter-search.clj
Created July 11, 2014 03:06
Search tweets without logging in Twitter
(require '[clojure.data.json :as json])
(require '[clj-http.client :as client])
(def url "https://twitter.com/i/search/timeline")
(defn build-params [query, current_time, cursor]
{:f "realtime",
:include_available_feature 1,
:include_entities 1,
:last_note_ts current_time,
@fanannan
fanannan / bookinfo.php
Created July 11, 2014 03:09
Retrieve info on a book from the National Diet Liberary
<?php
function check_tag($tag){
if (array_key_exists($tag, $_GET) && $_GET[$tag] <> ""){
$value = $_GET[$tag];
} else {
$value = "";
}
return $value;
}
@fanannan
fanannan / events.txt
Created January 5, 2015 07:10
MLHackason 準備その1(データ作成)
date,新規失業保険申請件数,ISM非製造業景況指数,消費者物価指数,ミシガン大消費者信頼感指数【速報値】,失業率,消費者物価指数【コア】,NY連銀製造業景気指数,建設許可件数,耐久財受注【除輸送用機器】,鉱工業生産,ミシガン大消費者信頼感指数【確報値】,フィラデルフィア連銀景況指数,生産者物価指数,中古住宅販売保留,小売売上高,中古住宅販売件数,耐久財受注,個人消費,生産者物価指数【コア】,雇用統計,ISM製造業景況指数,小売売上高【除自動車】,FOMC政策金利,貿易収支,四半期GDP,新築住宅販売件数,FOMC議事録,景気先行指数
2008/02/01,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0
2008/02/04,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/05,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/06,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/07,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/08,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
@fanannan
fanannan / sync.py
Last active August 29, 2015 14:18
Python script to synchronize two http servers
#!/usr/bin/python
# this script have two functions:
#
# A: Gatherer
# 1) gets all updated files, excluding the files under symlinks
# 2) makes an archive file with a password, containing all updated files
# 3) places it as a downloadable file on the docroot
#
# B: Updater
# 1) download an archive file with a password, containing all updated file, from another server
@fanannan
fanannan / d2v_test.py
Last active August 29, 2015 14:22
doc2vecのテストコード
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import sys
import logging
import codecs
import MeCab
import re
import hashlib