Skip to content

Instantly share code, notes, and snippets.

View akiomik's full-sized avatar
🇺🇦
I may be slow to respond.

Akiomi Kamakura akiomik

🇺🇦
I may be slow to respond.
View GitHub Profile
@akiomik
akiomik / 7-days-to-end-with-you-word-decoder.scala
Created August 21, 2022 06:19
A simple word decoder for "7 days to end with you"
val NUM_LETTERS = 25
implicit class RichChar(c: Char) {
def shiftLetter(i: Int): Char = {
if (c.isLetter) {
val (a, z) = if (c.isLower) ('a', 'z') else ('A', 'Z')
val n = i % NUM_LETTERS
(((c + n) % z % a) + a).toChar
} else {
c
@akiomik
akiomik / keybase.md
Created February 27, 2022 05:09
keybase.md

Keybase proof

I hereby claim:

  • I am akiomik on github.
  • I am akiomik (https://keybase.io/akiomik) on keybase.
  • I have a public key ASDOSsrhwIXhzWFVQAIouvDYDHBGcISMBlECAzuazqcZfAo

To claim this, I am signing this object:

@akiomik
akiomik / .gitattributes
Created December 19, 2013 15:30
gitattributes for scala
*.scala diff=scala
@akiomik
akiomik / .zshrc
Created January 13, 2013 12:54
[vim][vi][tmux][zsh]tmuxのステータスをpowerlineっぽくしてzshのviモードを使いやすくする
function zle-line-init zle-keymap-select {
vimode="${${KEYMAP/vicmd/NORMAL}/(main|viins)/INSERT}"
# update status line
if [ -n "$TMUX" ]; then
# tmux
if [ $vimode = "NORMAL" ]; then
statbg="colour236"
statfg="colour247"
statl1bg="colour240"
@akiomik
akiomik / ng.md
Last active January 3, 2016 07:39
case class and companion object
case class Calc(f: Int => Int, g: Int => Int, i: Int = 1) {
  def calc: Int = (f compose g)(i)
}

object Calc {
  def apply(f: Int => Int, g: Int => Int): Calc = new Calc(f, g)
}
@akiomik
akiomik / suko-bench.md
Last active January 2, 2016 22:59
suko puzzles solverのベンチマーク

概要

sukoというパズルの適当なソルバを書いたので簡単なベンチマークを取ってみた。

問題は2014/01/06のmetro紙より。

ベンチマーク方法

new scala.testing.Benchmark {
@akiomik
akiomik / rec.hs
Last active January 1, 2016 09:29
すごいH本第4章の再帰をscalaで書く
replicate' :: Int -> a -> [a]
replicate' n x
| n <= 0 = []
| otherwise = x : replicate' (n - 1) x
take' :; Int -> [a] -> [a]
take' n _
| n <= 0 = []
take' _ [] = []
take' n (x : xs) = x : take' (n - 1) xs
@akiomik
akiomik / rails.md
Last active December 29, 2015 19:10
rails環境構築メモ
brew install rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bashrc
echo 'eval "$(rbenv init -)"' >> .bashrc

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install -l # 入れれるバージョン
rbenv install 2.0.0-rc2
rbenv versions # バージョン確認
rbenv global 2.0.0-rc2 # rc2を適用
@akiomik
akiomik / vim-over.md
Last active December 28, 2015 20:29
vim-over使用時のエラー

環境

どのバージョンも osyo-manga/vim-over@97d98c605e43669b05e55f2f52e90c44e8f7f21c で確認しました。

  • エラーを確認したバージョン
    • vim 7.2 on debian(wheezy)
  • 正常に動いたバージョン
    • vim 7.3 on osx(10.9)
    • vim 7.4 on osx(10.9)
#!/bin/sh
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0