Skip to content

Instantly share code, notes, and snippets.

View tnoda's full-sized avatar

Takahiro Noda tnoda

View GitHub Profile
@tnoda
tnoda / page17.clj
Last active August 29, 2015 14:12
The id-mat function in page 17 of the book, "Clojure for Machine Learning" by Akhil Wali, does not work.
(defn id-mat
"Creates an identity matrix of n x n size"
[n]
(let [init (square-mat n 0 :implementation :clatrix)
identity-f (fn [i j n]
(if (= i j) 1 n))]
(cl/map-indexed identity-f init)))
;; clj-ml1.matrix-basics> (id-mat 5)
;; A 5x5 matrix
@tnoda
tnoda / fizzbuzz.org
Last active August 29, 2015 14:15
The FizzBuzz Question in the Imedio

The FizzBuzz Question in the Imedio

Imedians who originate from the planet Imedio love games of the Earth. The FizzBuzz Question is one of the most popular game among them, and is the winner of Imedian Game of the Year 2014.

Its rule is defined in a Wikipedia article as follows:

(let [N (read-line)
digits (map #(Character/digit % 10) N)
m3 (rem (apply + digits) 3)
m5 (rem (last digits) 5)
answer (cond
(and (zero? m3) (zero? m5)) "Fizz Buzz"
(zero? m3) "Fizz"
(zero? m5) "Buzz"
:else N)]
(println answer))
@tnoda
tnoda / agenda.org
Created March 30, 2015 01:41
3/31 gen-class 勉強会@HaLake プログラム案

gen-class 勉強会 プログラム

No.タイトル担当レベル
1Java のクラスの作り方@tnoda\_未経験者
2Docstring 逐条講義@tnoda\_ビギナー
3gen-class の内部実装の話@athos0220上級者
4アノテーションの使い方@tnoda\_中級者
5gen-class クイズ@tnoda\_中級者
@tnoda
tnoda / log
Created June 10, 2015 08:10
Installed Emacs 24.5 on Ubuntu 14.04 trusty
$ ./configure --with-x --with-x-toolkit=no --prefix=/opt/emacs
Configured for `x86_64-unknown-linux-gnu'.
Where should the build process find the source code? .
What compiler should emacs be built with? gcc -std=gnu99 -g3 -O2
Should Emacs use the GNU version of malloc? yes
(Using Doug Lea's new malloc from the GNU C Library.)
Should Emacs use a relocating allocator for buffers? no
Should Emacs use mmap(2) for buffer allocation? no
@tnoda
tnoda / croquettes.clj
Created July 20, 2015 09:45
コロッケ食べ放題
(ns tnoda.eat.croquettes
(:import (org.openqa.selenium By)
(org.openqa.selenium.firefox FirefoxDriver)
(org.openqa.selenium.interactions Actions)))
(defn -main
"Eats more than one thousand pieces of croquettes"
[& args]
(let [driver (doto (FirefoxDriver.)
(.get "http://vnctst.tir.jp/op0012-4/"))
@tnoda
tnoda / iwami.clj
Created August 18, 2015 06:01
Spigot サーバに Clojure の REPL を組み込んで立ち上げる
(ns tnoda.iwami
(:gen-class)
(:import (org.bukkit.craftbukkit Main))
(:require [clojure.tools.nrepl.server :as nrepl-server]))
(defonce server (atom nil))
(defn- nrepl-host
[]
(or (System/getenv "NREPL_HOST") "127.0.0.1"))
@tnoda
tnoda / imsmanifest.xml
Created February 16, 2011 15:12
A patch to fix the minor technical error in test case CO-03 of SCORM Test Suite (SCORM 2004 4th Edicion, v.1.1.1)
<?xml version = "1.0" standalone = "no"?>
<manifest identifier = "LMSTestPackage_CO-03" version = "1.1.1"
xmlns = "http://www.imsglobal.org/xsd/imscp_v1p1"
xmlns:adlcp = "http://www.adlnet.org/xsd/adlcp_v1p3"
xmlns:adlseq = "http://www.adlnet.org/xsd/adlseq_v1p3"
xmlns:adlnav = "http://www.adlnet.org/xsd/adlnav_v1p3"
xmlns:imsss = "http://www.imsglobal.org/xsd/imsss"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p1.xsd
http://www.adlnet.org/xsd/adlcp_v1p3 adlcp_v1p3.xsd
@tnoda
tnoda / cmigemo.rb
Created February 14, 2012 06:25
A homebrew formula for cmigemo on Mac OS X 10.6.8
require 'formula'
class Cmigemo < Formula
url 'http://cmigemo.googlecode.com/files/cmigemo-default-src-20110227.zip'
homepage 'http://www.kaoriya.net/software/cmigemo'
sha1 '25e279c56d3a8f1e82cbfb3526d1b38742d1d66c'
depends_on 'nkf'
def patches