Random things I’ve learned while working on my projects.

OpenWrt 22.03 Stuffs

1. Post-installation Upgrade all packages SSH to the router. Check if ca-certificates is installed Try opkg update first, if errors code 4 occurs, then: opkg update --no-check-certificate \ opkg install ca-certificates --no-check-certificate Add a password Open luci web interface. System 馃憠 Administration 馃憠 Router Password 馃憠 Set password 馃憠 Save. 2. Personalization Rename the router Open luci web interface. System 馃憠 System 馃憠 Hostname 馃憠 Save & Apply. Change NTP server Open luci web interface....

January 6, 2023 路 10 min 路 2062 words 路 Me

High swap usage on Linux Server

Why should I care if my server is using swap? Swap is slower than RAM Swap is written to SSD, which has a limited number of write cycles, while RAM is not You spent money on RAM, don鈥檛 waste it Swappiness value Range: 0-100 Default: 60 0: Swap is used only when absolutely necessary 100: Swap is used as much as possible Check swappiness value 1 cat /proc/sys/vm/swappiness Change swappiness value Temporarily 1 sudo sysctl vm....

January 3, 2023 路 1 min 路 105 words 路 Me

Self Sign SSL Certificate

Generating a new SSL certificate 1 2 3 4 5 6 7 8 9 10 11 12 13 14 openssl req \ -newkey rsa:2048 \ -x509 \ -nodes \ -keyout TLS.key \ -new \ -out TLS.cert \ -subj /CN=<Issuer> \ -reqexts SAN \ -extensions SAN \ -config <(cat /etc/ssl/openssl.cnf \ <(printf '[SAN]\nsubjectAltName=DNS:<HOST_NAME>,IP:<IP_ADDRESS>')) \ -sha256 \ -days <EXPIRY_IN_DAYS> Change the <Issuer> to the name of your liking. Add as much DNS:<HOST_NAME> and IP:<IP_ADDRESS> as you want, separated by comma....

December 13, 2022 路 2 min 路 310 words 路 Me

Clearing old commits from a repository

Use case A repository that hosts a static website. Steps Creating a new branch 1 git checkout --orphan latest_branch Adding files to the new branch 1 2 git add -A git commit -am "update" Deleting the old branch 1 git branch -D main Renaming the new branch 1 git branch -m main Force push to the remote repository 1 git push -f origin master References How can I delete old commits in Github via terminal?...

December 13, 2022 路 1 min 路 79 words 路 Me

How to automatically sign commits with SSH key

Generating a new SSH key Read this to learn how to generate a public/private key pair. Adding the SSH key to your GitHub account Profile > Settings > SSH and GPG keys > New SSH key Enter a title of your choice and the public key. Change key type to Signing key and click Add SSH key. Configuring Git to sign commits by default 1 2 3 git config --global commit....

December 12, 2022 路 1 min 路 97 words 路 Me