[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