Skip to content

Instantly share code, notes, and snippets.

View arcizan's full-sized avatar

arcizan arcizan

  • craftsman-software, Inc.
  • Tokyo, Japan
View GitHub Profile
@arcizan
arcizan / 99problems.scala
Last active August 29, 2015 14:16
99 Problems
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
@arcizan
arcizan / Main.scala
Last active August 29, 2015 14:16
binary search and quick sort
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)
@arcizan
arcizan / Main.scala
Last active August 29, 2015 14:16
binary tree
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]
@arcizan
arcizan / make-mew
Created April 8, 2015 05:54
Install script for Mew
#!/bin/bash
######################################################################
# declare variables
full_cmdname="$0"
cmdname=$(basename -- "$full_cmdname" ".sh")
LD_RUN_PATH="/usr/local/lib"
export LD_RUN_PATH
# define functions

夢的な何か

  • Scala/セキュリティ/暗号など勉強
  • ポートフォリオ作る
  • 副収入が欲しい
  • 定年までは働かない
  • 日本脱出
  • 英語 (日常会話)
  • 筋トレ
@arcizan
arcizan / s3cli
Last active June 6, 2016 07:54
aws-cli wrapper for S3
#!/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"