Home
CJ
Cancel

Web service worker

This is a note for MDN web service worker. I will clarity some concepts and add some examples. Clarify skipWaiting() and clients.claim() skipWaiting() skipWaiting() is used in the install event ...

Linux regular cmd

ps aux ps aux is a command to list all the processes running on the system. lsof -i:port lsof -i:port is a command to list all the processes that are using the port. nohup command & nohup ...

Postgres init setup

Install postgres apt update apt upgrade -y apt install postgresql postgresql-contrib -y Set password for postgres user switch to postgres user su - postgres enter postgres shell psql set ...

How to use nginx to setup https with certbot and let's encrypt

Install nginx sudo apt update sudo apt upgrade -y sudo apt install nginx -y press ‘Enter’ if it prompts to restart some program. Install certbot I’m in Ubuntu 20.04, so I use snap to install c...

How to set a simple reverse proxy with nginx

Add a new server block sudo vim /etc/nginx/sites-enabled/yourdomain.com Add the following content server { listen 80; listen [::]:80 server_name yourdomain.com; # or _ if you want t...

Data structure min binary heap

Definition ADT: the amount of vals in heap is n. pop() -> val O(log(n)) get and delete the min val. push(val) -> None O(log(n)) insert a val into heap. top() -> val O(1) get the min v...

How to use tar and gzip

gzip gzip compress file touch test.txt gzip test.txt it will make test.txt to test.txt.gz gzip decompress file gzip -d test.txt.gz it will make test.txt.gz to test.txt tar tar compress fi...

How to setup clash in linux

Setup clash Download clash github clash wget -O clash.gz https://github.com/Dreamacro/clash/releases/download/v1.16.0/clash-linux-amd64-v1.16.0.gz Unzip clash gzip -f clash.gz -d make i...

How to modify path environment variable in fish shell

Set path environment variable permanently set -U fish_user_paths /usr/local/bin $fish_user_paths This will prepend /usr/local/bin permanently to your path, and will affect the current session an...

How to download file in linux

Download file wget -O httpbin.html https://httpbin.org it will download the file from https://httpbin.org and save it as httpbin.html