This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
document.write(location.href.length); | |
</script> |
Copyright (c) 2018 by Cam Song (https://codepen.io/camsong/pen/wcKrg)
- https://nipp.cf/?#Kazoekata//y1awVVAN14hRUHiyo13haU...
- [https://nipp.cf/#Tetris/es2017/VY/RiuIwFIZfRQMOiUlc...](https://nipp.cf/#Tetris/es2017/VY/RiuIwFIZfRQMOiUlcq9UZjUep7sJCd0BwLtSSC21TGq1N6cRZZCrMeyzsyy37HpsyV3uV/5DvnP//3w5Vy0Bi4utFFbYXV+pg1bdcNRNGJSIivRax1aZo7TB5T02FVxAlEPLhk2Qx9JkGX2jOu6EIuTdcxBTa+yijJU3kNOafA15FWkLZDbjnj7rPB5v1KnMtElx+CQiRpISlA0RzvW3rmPqLNo65Tx4ecEYhIdMlrFgKIWjoCz3zRUphHwW0lGQblZBRt06plOAJnWIFbUXenUjr5WfkHAaDpyalIE2cxkzC2dHN5xKiiD8yPuizMfOcmLAhG8vIAqW28yi5z/rMY5aPFzyYck+K3B3KYEScRd4JSM7BPV3XNJdC5a+q1ZxdUzhTyk6QUwgE56d50LifpEt+4oG8u2bBvSE1bAAh12vg98XWZXOElrWz151gNqj13KUnTtc13lBAs2M1R4Q52cAL9PfXbzRFfz4+kDA9XRSq+v7y/AM2dM320UjW9auyL/qizNXiHZtM+JrcExNfL6q
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# Backup purpose | |
docker images --format="container:{{.Repository}}:{{.Tag}}" | sed 's/container://g' | grep -v "<none>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (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 |