Skip to content

Instantly share code, notes, and snippets.

View nwtgck's full-sized avatar
:octocat:
Feel free to make my English natural by native speakers

Ryo Ota nwtgck

:octocat:
Feel free to make my English natural by native speakers
View GitHub Profile
@nwtgck
nwtgck / README.md
Last active October 24, 2018 15:55
Othello Game Tree

Othello Game Tree

import scala.collection.mutable
trait Memorized[T,R] {
val cache = new mutable.HashMap[T,R]
def cacheOrApply( t:T )( f: => R ): R = cache.getOrElse(t, {
val rv = f
cache += t -> rv
rv
})
}
<script>
document.write(location.href.length);
</script>
#! /bin/sh
# Backup purpose
docker images --format="container:{{.Repository}}:{{.Tag}}" | sed 's/container://g' | grep -v "<none>"
#! /bin/sh
# (from: https://qiita.com/mochizukikotaro/items/ae7ae1461ea4bf495bd0)
VERSION=1.23.1
sudo curl -L "https://github.com/docker/compose/releases/download/$VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo docker-compose -v
@nwtgck
nwtgck / install_docker_for_ubuntu16.sh
Last active August 7, 2019 12:46
Install docker for Ubuntu16
#! /bin/sh -x
# (from: https://soralab.space-ichikawa.com/2017/04/docker-ce-install/)
sudo apt-get update
sudo apt-get install -y\
apt-transport-https \
ca-certificates \
curl \
software-properties-common

Keybase proof

I hereby claim:

  • I am nwtgck on github.
  • I am nwtgck (https://keybase.io/nwtgck) on keybase.
  • I have a public key ASCVjBOylZl2feq-9k_stMOgvRwSEdNUVOhuMr6R0ELlXgo

To claim this, I am signing this object:

# (from: http://melborne.github.io/2013/08/30/monkey-patching-for-prudent-rubyists/)
class Array
alias :get_at :[]
private :get_at
alias :set_at :[]=
private :set_at
def in_bound?(idx)
0 <= idx && idx < self.size