- Scala/セキュリティ/暗号など勉強
- ポートフォリオ作る
- 副収入が欲しい
- 定年までは働かない
- 日本脱出
- 英語 (日常会話)
- 筋トレ
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/zsh -fi | |
emulate -L zsh | |
setopt prompt_subst hist_reduce_blanks hist_ignore_dups hist_ignore_all_dups hist_ignore_space \ | |
hist_expire_dups_first hist_save_no_dups # xtrace | |
typeset -r s3_scheme='s3:/' | |
typeset -r s3cli_home="${S3CLI_HOME:-$HOME/.s3cli}" | |
typeset -r s3cli_config_file="$s3cli_home/config" |
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/bash | |
###################################################################### | |
# declare variables | |
full_cmdname="$0" | |
cmdname=$(basename -- "$full_cmdname" ".sh") | |
LD_RUN_PATH="/usr/local/lib" | |
export LD_RUN_PATH | |
# define functions |
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
object Main { | |
trait Node { | |
val v: Int | |
def size(): Int | |
def max(): Int | |
def min(): Int | |
def sum(): Int | |
def avg(): Double | |
def find(n: Int): Option[Node] |
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
object Main { | |
import scala.util.{Failure,Try,Success} | |
def bsearch(n: Int, xs: Vector[Int]): Try[Int] = { | |
def _bsearch(l: Int, r: Int): Try[Int] = { | |
if(l < r){ | |
(l + r) / 2 match { | |
case m if xs(m) == n => Success(m) | |
case m if xs(m) > n => _bsearch(l, m-1) | |
case m if xs(m) < n => _bsearch(m+1, r) |
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
object Main { | |
def last[T](xs: List[T]): T = xs.last | |
def penultimate[T](xs: List[T]): T = xs.init.last | |
def nth[T](index: Int, xs: List[T]): T = xs.apply(index) | |
def length[T](xs: List[T]): Int = xs.length | |
def reverse[T](xs: List[T]): List[T] = xs.reverse |