[OSX Setup] n (nodejs): Permission denied

tl;dr # error on install n install 8.2.1 mkdir: /usr/local/n/versions/node: Permission denied mkdir: /usr/local/n/versions/io: Permission denied # create dir before install sudo mkdir /usr/local/n sudo chown -R $(whoami) $_ # then success n install 8.2.1 Ref: GitHub: Permission denied before running with sudo #416

Read More

Golang Error: invalid type for composite literal

In my case, the underlying type is not struct. // Device contains strings of the device name type Device string // NativeDevice stands for smartphone app(e.g. iOS/Android) type NativeDevice Device // AppleDevice stands for iOS device. type AppleDevice NativeDevice // Error pattern: using `struct type` for AppleDevice. func NewIPhoneDevice() AppleDevice { return AppleDevice{} // => Error: invalid type for composite literal. } // Corrent pattern: using `string type` for AppleDevice. func NewIPhoneDevice() AppleDevice { return “iphone” // use `string` } https://play.golang.org/p/cLSmvB4bZD2

Read More

Xiaomi Mi A1のSIMカードトレイの交換

旅行先でSIMカードトレイを無くしてしまったため、Parts4Repairで代わりのスペアを注文することにしました。 SIMカードトレイが$2.9, 送料が$3.53で、合計$6.43でした。 めちゃくちゃ安くてビビります。

Read More

How to check/confirm SSH secret key password | SSH用秘密鍵のパスワードを確かめる方法

Answer is from: stackoverfrow | How do I verify/check/test/validate my SSH password? $ ssh-keygen -y -f <key file> $ ssh-keygen -y -f my_key.pem # corrent password Enter passphrase: ssh-rsa AAAABBBBCCCCDDDDEEEEFFFF…. # wrong password Enter passphrase: Load key “/Users/takuma/.ssh/eureka.pem”: incorrect passphrase supplied to decrypt private key ssh-keygen has many feature…

Read More

Command to clean unused Docker container/images/volumes to get disk space | 不要なDockerコンテナ・イメージ・ボリュームを削除するコマンド

# check disk size df -h docker run –rm alpine df -h # remove stopped container, unused images, unused volumes docker rm $(docker ps -q -f ‘status=exited’) docker rmi $(docker images -q -f ‘dangling=true’) docker volume rm $(docker volume ls -q -f ‘dangling=true’) # check disk size again df -h docker run –rm alpine df -h

Read More

Indirect expantion in shellscripit on Alpine – Bash以外での変数の間接展開

tl;dr use eval “echo \${$FOO}” #!/bin/sh VALUE1=”happy!” # target value ENV_VAR=VALUE1 # variable bname echo $VALUE1 # => happy! echo $ENV_VAR # => VALUE1 echo ${ENV_VAR} # => VALUE1 echo \${$ENV_VAR} # => ${VALUE1} #=== ash or other shells ===# eval “echo \${$ENV_VAR}” # => happy! #=== bash supports original indirect expantion, but not ash on Alpine linux ===# echo ${!ENV_VAR} #=== example for “if” “test” conditions ===# test -n $ENV_VAR \ # (1) && test “$(eval “echo \${$ENV_VAR}”)” == “happy!” \ # (2) && echo “I’m Happy!!” # (1) if ENV_VAR is set, # (2) and if $VALUE1 == “happy!”

Read More

pandasメモ(axis, level)

axis=0: 行を対象に処理を実行 axis=1: 列を対象に処理を実行 level=[0,1,2]: groupby() や set_index() で使われるMultiIndexに対して、対象となるIndex(順番)の指定 df.stack // 列を行に旋回(ピボット)する df.unstack // 行を列に旋回(ピボット)する df.replace // データの置換を行う df.rename // 軸の命名を変更する df.drop_duplicated // 重複データの削除 df.qcut // ビニング

Read More

Install numpy and pandas on alpine:python3

tl;dr Install build tool and create symbolic link for locale. $ apk add –update curl gcc g++ $ ln -s /usr/include/locale.h /usr/include/xlocale.h $ pip install numpy # => success happy python life 🙂 error messages Before install g++, I got error below, /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find Scrt1.o: No such file or directory /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find crti.o: No such file or directory /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssp_nonshared /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lc /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find crtn.o: No such file or directory collect2: error: ld returned 1 exit status /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find Scrt1.o: No such file or directory /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find crti.o: No such file or directory /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssp_nonshared /usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lc…

Read More