Skip to content

Instantly share code, notes, and snippets.

View koungkub's full-sized avatar
🏠
Working from home

Koung koungkub

🏠
Working from home
View GitHub Profile
@koungkub
koungkub / purge-cache.sh
Created April 10, 2023 07:11
Go clear cache package
go clean -cache -modcache -i -r
@koungkub
koungkub / permission.sh
Created April 3, 2023 07:13
docker user permission, full error (chown: changing ownership of '/absolute/path': Permission denied)
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R
@koungkub
koungkub / cloud-init.yml
Last active February 27, 2023 09:48
cloud-init file for local ssh to multipass instance
users:
- default
- name: ubuntu
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- {Your local's public key}
curl -fsSL https://get.docker.com | sh
@koungkub
koungkub / initial-scala.sh
Created December 28, 2022 04:45
Create command from template in scala
sbt new sbt/scala-seed.g8
@koungkub
koungkub / docker-compose.yml
Last active April 3, 2023 11:06
Create postgresql instance through docker-compose
version: '3.7'
services:
pg:
image: postgres:15-bullseye
restart: always
networks:
- internal
shm_size: 256mb
healthcheck:
test: [ 'CMD', 'pg_isready', '-U', 'postgres' ]
# linux-based
netstat -lnptu
# mac-based
lsof -i 8080 | grep LISTEN
ps -ef | grep 1029
kill -9 1029
# linux system infomation
lsb_release -a
# macos system information
sw_vers
# kernal information
uname -a
@koungkub
koungkub / sysctl.conf
Created May 22, 2022 07:53
tuning debian web server by p'hhck
# debian based
# Protect Against TCP Time-Wait
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_rfc1337 = 1
# reload
# sysctl -p
@koungkub
koungkub / benchmark.sh
Created April 28, 2020 07:55
I/O benchmark
// install
sudo apt install fio -y
// read
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=random_read.fio --bs=4k --iodepth=64 --size=4G --readwrite=randread;
// write
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=random_write.fio --bs=4k --iodepth=64 --size=4G --readwrite=randwrite;