Skip to content

Instantly share code, notes, and snippets.

Avatar

Shotaro Kohama shotarok

View GitHub Profile
View LavaYoga.js
function LavaYoga() {
var criteria = "from:reserve@yoga-lava.com 予約完了";
eachUnreadMessage(criteria, function (message) {
var subject = message.getSubject();
Logger.log(subject);
var [matched, place] = /【LAVA】([^\n]+)予約完了/.exec(subject);
var body = message.getBody();
Logger.log(body);
var [matched, month, day, sh, sm, eh, em, kind] = /(\d*)(\d*)\([月火水木金土日]\) (\d\d):(\d\d)(\d\d):(\d\d)[^\n]*\n([^\n]+)/.exec(body);
Logger.log(matched);
@shotarok
shotarok / ADMM.ipynb
Created Apr 20, 2017
Alternating Direction Method of Multipliers (ADMM) for Lasso
View ADMM.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shotarok
shotarok / DMMEnglish.gs
Created Jan 22, 2017
講師名も含んだカレンダーイベントを作成するスクリプト
View DMMEnglish.gs
function DMMEnglish() {
var criteria = "from:info@mail.dmm.com レッスン予約完了";
eachUnreadMessage(criteria, function (message) {
var body = message.getBody();
var [matched, year, month, day] = /ご予約日:(\d+)(\d\d)(\d\d)日/.exec(body);
var [matched, sh, sm] = /開始時間:(\d\d)(\d\d)分/.exec(body);
var [matched, teacher] = /講師名:([^\n]+)/.exec(body);
var sdate = new Date(year, month-1, day, sh, sm);
var edate = new Date(sdate.getTime() + 30 * 60000);
createEvent("DMM英会話 " + teacher + "先生", sdate, edate);
@shotarok
shotarok / six_is_required.patch
Created Oct 22, 2016
A patch to add a dependency to setup.py for pyknp-0.3
View six_is_required.patch
--- pyknp-0.3/old_setup.py 2016-10-22 14:18:26.000000000 +0900
+++ pyknp-0.3/setup.py 2016-10-22 14:18:48.000000000 +0900
@@ -25,4 +25,5 @@
url='https://bitbucket.org/ku_nlp/pyknp',
scripts=['pyknp/scripts/knp-drawtree', ],
packages=find_packages(),
+ install_requires=['six'],
)
@shotarok
shotarok / test.py
Created Jul 23, 2016
A test code to extract ID from SUICA/PASMO through nfcpy
View test.py
#!/usr/bin/env python
# coding:utf-8
from __future__ import print_function
from binascii import hexlify
import sys
import nfc
@shotarok
shotarok / tsv_to_vw.py
Created May 3, 2016
Convert tsv files in "Kaggle Display Advertising Challenge Dataset" into vwopal wabbit format files
View tsv_to_vw.py
#!/usr/bin/env python
# conding:utf-8
import sys
def main():
for index, line in enumerate(sys.stdin):
elems = line.rstrip().split("\t")
label, nums, categories = elems[0], elems[1:14], elems[14:40]
vw_label = "1" if label == "1" else "-1"
@shotarok
shotarok / build_quine.rb
Created Dec 12, 2015
Builder of CAMPHOR- LOGO Quine
View build_quine.rb
eval $s=%w(
s = %(eval$s=%w(#{$s})*"");
bitmap="10qhq35t4sngfv3emvm45wp24mq4c8eyk12wiblhr85h5a6m3jngv6j1iz7dohhbzl2gdk8qe801jmbg070z3yn60nbx6fpld5odcrr9izg8d81kgvs0ta4kmvudmens7wpyxm5pdigtmry0xxringsirqwudjizcv7lex3pr9pvqcxr67lln8he73ks0m8ieu8q5nmpu02d40x94fwbp1zywga8uodieaptltwjbgo0zuez1l90j7lhp8pufir8rnv965w7m7a1n6rjqgjzmj3n53bthfr5xthmofqpo9jtkmg1zngzq9y071lm1gwssnt2htwk0h5x6a4eekp6v3u08lfxy2jl4x37tnkri2li3cdby1wuo5to2yhmm240y4ex8eo7bxiye4iv9rx82piz169vmy2egxcv1vprv69idmsj67yqfbag5o9ieza9jvvoqwtrwa5l5s9smbup6jxxd54buhip7ym490racs5n69yd6b2htlisqvarif85716ic4ezp1gby3wsxxnqkwiqs7juoq2hxrbhjpmur2pl08cbin2g16oib1oh785hfqoau05dkn0fzgc2ochv3ely3jtjvyllsrjsi7fktizgpvyw0xvra1dn77edqx5xp1np9h6rdpya5iwspwl9cs179gui6g6xnmlnsrd3ixp9bapnii182ky47rso25ysbq4kohtfxhl9yko9ox0963xyjc677kyt8xpep9e2kr54q4jiakl0lwe0pxxnuy4mse0an7f6cqnzenllsktrnhmhe4igwkp2ay2af1mpi4wekkqayknhidg2nwc2lkvjaxsssxaypaxu31u8lhlnze68ot0rm049joqocwxozf230wqgojqxyhckd0qzklt76v2mgqyz9t3uvzcjdiloqprloheqefusf9zyltsbclqimohacoe6a892cy5roq3ijcc49j53qjfx10j
View camphor-logo-quine.rb
eval$s=%w( s=%(eval$s
=%w(#{$s})*"") ;bitmap="10qh
q35t4sngfv3emvm45 wp24mq4c8eyk12wib
lhr85h5a6m3jngv6j1i z7dohhbzl2gdk8qe801
jmbg070z3yn60nbx6fpld 5odcrr9izg8d81kgvs0ta
4kmvudmens7wpyxm5pdigt mry0xxringsirqwudjizcv
7lex3pr9pvqcxr67lln8he7 3ks0m8ieu8q5nmpu02d40x9
4fwbp1zywga8uodieaptltwj bgo0zu
@shotarok
shotarok / seed_of_quine-fout-im-mtb.rb
Created Nov 6, 2015
seed of quine (FO -> IM -> MTB)
View seed_of_quine-fout-im-mtb.rb
n=0;eval $s=%w(
s = %(#{";"*76}n=#{(n+1)%3};eval$s=%w(#{$s})*"");
encoded = ["4Kl96c_g`LvCu=@^JUlH>MpU=?QAnHn8SB=YkHzDskA9GXved>ZiNEnqEeEZGJBs5uZ?y@GVGq5tfuQ@AF_APd7IHs1=QlGyCdzk8KnZjIhYxqe3zF3fWX[Dm1bkX:R3eTtK`kF:IM_bUquQQi^vT]wr]adTi9sGH3U:a4wQjGwVIS4lX1Z[:8id_>9qK8_7ThSiafvwK4cyjYrw;E8ytwHKQClRV^U@txJbAS2wmuGxU9[L_ur[9OOB[qlBx=q7t^ENDqbhf1Ew1;<9QBvAX@P^2qa[ZrP_PJUrFvq2=Ibo0qRoMvAvwz[<0JWijeMX_>^NkACxNXnq>POW[mt<^Rb;ffDB<hBFBsQnG^ywgtxj:Et27Yc6ARsG`xEW3LZ2Z4ZNZPgT:4eePj5ckTg7<MmSatc4rPd0B`p4ZB`LRuQDtZm[>7=Sh^zts4NtmRRjK]@Jl5bJ0iCh<rB7AS?]QK<Ic6WBt[HvcI5FfAc", "`TVE?Er6GLiJg=q?gQQu^3Qt<PfR<Qg?lQd9J?swp4y@:<35dDy8Kg3FbGZWsLCI7VvV?EObb1UEjxVkImDa4<vduDxyU>vOL5CCmIno^yPo;jksiiI6F=W?3bewgO>UxhI;kI_BWWeqdpI6ouZCzPJuTqXxE__jg`np3JQ2c`W`P<@MhEL9aKP;T6nR3W4khw7r`wU`;hKK`>pAE^B62F3jGAIKvNvm7[QpJ=WosH`ARbNC^ZWNJq]N9jMiz1`6Q2vBCbC]3UBq19S5Mer5`Sc0BT4UK<9y1QHk3uD471Vzs0z:;qgSpjPHhZyGT:0m?=r<uI6d_;K@N9L<<ZrX;phj[8rHoId9E[4C@ZXGf2?FJIWv?Fa_Sc5ZOI;P6H@dVPneFVg`;C4NQ:l;zq1Ug0IPheQIl5u3dmpCo[3xS2E>L2]2mV;^L<J]uDg:KzuLFcm:fU
@shotarok
shotarok / fout-im-mtb.rb
Created Nov 6, 2015
Quine (FreakOut -> Intimate Merger -> M.T.Burn)
View fout-im-mtb.rb
;;;;;;;;;;;
;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;; ;;;;;;;;; ;;;;;;
;;;;;n=1;eval$s=%w(s=%(#{"; "*81}n =#{n+1
};eval $s=%w(#{ $s})* "");en
coded= ["4K l96c _g`Lv
Cu=@^JU lH> Mp U=?QA
nHn8SB= YkHz Dsk A9GXv
You can’t perform that action at this time.