Skip to content

Instantly share code, notes, and snippets.

View tmyymmt's full-sized avatar

Tomoya Yamamoto tmyymmt

View GitHub Profile
@tmyymmt
tmyymmt / init
Last active April 21, 2023 09:38
for Ubuntu on Windows WSL2
visudo
# {username} ALL=NOPASSWD: AL
sudo apt update
sudo apt upgrade
sudo apt install \
language-pack-ja-base language-pack-ja ibus-mozc \
zsh \
git \
@tmyymmt
tmyymmt / .zshrc
Last active April 21, 2023 09:02
.zshrc
setopt nonomatch
alias ll='ls -al'
alias windows='nkf -sLw --overwrite'
alias linux='nkf -wLu --overwrite'
alias emacs='emacs --no-windows'
HISTFILE=$HOME/.zsh_history # 履歴をファイルに保存する
HISTSIZE=100000 # メモリ内の履歴の数
SAVEHIST=100000 # 保存される履歴の数
@tmyymmt
tmyymmt / zsh_asdf_memo.txt
Last active August 17, 2022 05:02
asdf memo
# zsh
- https://wiki.archlinux.jp/index.php/Zsh#.E3.82.B5.E3.83.BC.E3.83.89.E3.83.91.E3.83.BC.E3.83.86.E3.82.A3.E6.8B.A1.E5.BC.B5
## sheldon
- https://github.com/rossmacarthur/sheldon
- https://ryota2357.com/blog/2022/zsh-plugmanager-zplug-to-sheldon/
- https://ktrysmt.github.io/blog/migrate-zinit-to-sheldon/
- https://zenn.dev/ganta/articles/e1e0746136ce67
# asdf
@tmyymmt
tmyymmt / plugins.toml
Created August 17, 2022 04:23
zsh sheldon .sheldon/
shell = 'zsh'
[plugins.zsh-defer]
github = 'romkatv/zsh-defer'
apply = ['source']
[templates]
defer = { value = 'zsh-defer source "{{ file }}"', each = true }
[plugins.compinit]
@tmyymmt
tmyymmt / docker_memo.txt
Last active August 15, 2022 08:01
Docker without Docker Desktop
# Docker without Docker Desktop
## Docker without Docker Desktop for macOS
- https://qiita.com/kyosuke5_20/items/cd5f3df4e827c34d7c4a
## Docker without Docker Desktop for Windows
- https://qiita.com/ohtsuka1317/items/617a865b8a9d4fb67989
@tmyymmt
tmyymmt / k8s_kubernetes_memo.txt
Last active August 15, 2022 08:01
k8s kubernetes
# minikube
- https://zenn.dev/gekal/articles/minikube-on-mac-as-local-k8s-env
@tmyymmt
tmyymmt / SolutionForNestedMatchStatements.scala
Created September 15, 2012 18:56
Solution for nested match statements
// see https://gist.github.com/2382341
// scalaz for only solution3
import scalaz._
import Scalaz._
object SolutionForMultiNestedMatchforMyStudy {
def f(num: Int): Option[Int] = {
num match {
def compute1(maybeFoo: Option[Foo]): Option[Int] =
for {
foo <- maybeFoo
bar <- foo.bar
baz <- bar.baz
} yield baz.compute
// for compute2
import scalaz._
import Scalaz._
@tmyymmt
tmyymmt / HexBytesUtil.scala
Created September 15, 2012 09:37
hex2bytes and bytes2hex fixed
object HexBytesUtil {
def hex2bytes(hex: String): Array[Byte] = {
hex.replaceAll("[^0-9A-Fa-f]", "").sliding(2, 2).toArray.map(Integer.parseInt(_, 16).toByte)
}
def bytes2hex(bytes: Array[Byte], sep: Option[String] = None): String = {
sep match {
case None => bytes.map("%02x".format(_)).mkString
case _ => bytes.map("%02x".format(_)).mkString(sep.get)
@tmyymmt
tmyymmt / HexBytesUtil.scala
Created September 14, 2012 09:58
hex2bytes and bytes2hex
object HexBytesUtil {
def hex2bytes(hex: String): Array[Byte] = {
if(hex.contains(" ")){
hex.split(" ").map(Integer.parseInt(_, 16).toByte)
} else if(hex.contains("-")){
hex.split("-").map(Integer.parseInt(_, 16).toByte)
} else {
hex.sliding(2,2).toArray.map(Integer.parseInt(_, 16).toByte)
}