Skip to content

Instantly share code, notes, and snippets.

body {
word-break: keep-all;
overflow-wrap: break-word;
}
@jhaemin
jhaemin / server.ts
Created January 26, 2021 13:28
Resolve blocked `ts-node-dev` respawn when using `new PrismaClient()`
process.on('SIGTERM', () => {
process.exit()
})
@jhaemin
jhaemin / script.sh
Created November 25, 2020 04:44
Refresh macOS Dock icons cache
rm /var/folders/*/*/*/com.apple.dock.iconcache;killall Dock
@jhaemin
jhaemin / kill.sh
Last active November 12, 2020 06:57
Kill the process on port
# Find
sudo lsof -i :3000
# Kill
kill -9 <PID>
# 711
# chroot
compgen -u # list all users
compgen -g # list all groups
cut -d: -f1 /etc/passwd # list local users
cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1 # human users
cat /etc/group # list all groups on system
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
GRANT type_of_permission ON database_name.table_name TO 'username'@'localhost';
REVOKE ~ ;
-- ALL PRIVILEGES- as we saw previously, this would allow a MySQL user full access to a designated database (or if no database is selected, global access across the system)
-- CREATE- allows them to create new tables or databases
-- DROP- allows them to them to delete tables or databases
<picture>
<source srcset="image-night.jpg" media="(prefers-color-scheme: dark)">
<img src="image-day.jpg">
</picture>
# view
nano /var/log/syslog
# clear
sudo truncate -s 0 /var/log/syslog
# user specific crontab
# edit crontab
crontab -e
# view the contents of crontab
crontab -l
# erase crontab
# WARNING: The following command will not ask you to confirm that you want to erase your crontab.
server {
server_name example.com;
# optional
client_max_body_size 100M;
# remove ending /
# [warn] it may not need for Next.js
# [warn] it may generate an error when establish socket.io connection
# rewrite ^/(.*)/$ /$1 permanent;