Skip to content

Instantly share code, notes, and snippets.

@taiki45
taiki45 / maybe_monad.hs
Last active December 29, 2015 01:39
How monads work for OOProgrammers. Monad in object-oriented-language is useless unless for leaning.
import Control.Monad
bind :: (Monad m, Functor m) => m a -> (a -> m b) -> m b
bind m f = join (fmap f m)
unit :: Monad m => a -> m a
unit = return
compose :: (b -> c) -> (a -> b) -> (a -> c)
compose = (.)
@taiki45
taiki45 / ruby-install
Last active October 10, 2015 18:18
Ruby install 覚え書き
# Ruby install 覚え書き
# gcc make gcc-c++ zlib-devel httpd-devel openssl-devel curl-devel libreadline-dev readline-dev あたりがはいっているか確認
# install rbenv
$ cd
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ source ~/.bashrc
@brendano
brendano / gist:39760
Created December 24, 2008 20:11
load the MNIST data set in R
# Load the MNIST digit recognition dataset into R
# http://yann.lecun.com/exdb/mnist/
# assume you have all 4 files and gunzip'd them
# creates train$n, train$x, train$y and test$n, test$x, test$y
# e.g. train$x is a 60000 x 784 matrix, each row is one digit (28x28)
# call: show_digit(train$x[5,]) to see a digit.
# brendan o'connor - gist.github.com/39760 - anyall.org
load_mnist <- function() {
load_image_file <- function(filename) {