Skip to content

Instantly share code, notes, and snippets.

View samson-sham's full-sized avatar
🏠
Working from home

Samson Sham samson-sham

🏠
Working from home
View GitHub Profile
@samson-sham
samson-sham / cdk.md
Last active February 14, 2022 12:57
AWS CDK Workflow

Prerequisite

  • Install Yarn (Required by Projen's package "awscdk-app-ts")
  • Install AWS CLI (Required by CDK)

Install Yarn

sudo npm install -g yarn

Install AWS CLI

Guide curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"

@samson-sham
samson-sham / vim.md
Last active October 4, 2022 02:54
binary edit
  • Open the binary file in vim
$ vim binaryFile
:set binary
@samson-sham
samson-sham / root_known_hosts.sh
Created October 14, 2021 08:27
root known host
sudo find / -name known_hosts
/private/var/root/.ssh/known_hosts
@samson-sham
samson-sham / nodejs.sh
Last active September 28, 2021 05:08
install nodejs on ubuntu
wget https://nodejs.org/dist/v14.17.6/node-v14.17.6-linux-x64.tar.xz
tar Jxvf node-v14.17.6-linux-x64.tar.xz
# Automatically calculate relative path with -r
sudo ln -rs node-v14.17.6-linux-x64/bin/* /usr/local/bin
# Done
# Show symlink binded path
@samson-sham
samson-sham / bitnami.sh
Created September 23, 2021 09:31
Bitnami stack
sudo /opt/bitnami/ctlscript.sh stop apache
# Disable Apache from automatically executed from boot
sudo mv /opt/bitnami/apache2/scripts/ctl.sh /opt/bitnami/apache2/scripts/ctl.sh.disabled
# ref: https://community.bitnami.com/t/disabling-apache-on-restart-startup/57772
@samson-sham
samson-sham / network.sh
Created May 20, 2021 09:45
network thing
# If host name cannot be resolved
# check DNS server in /etc/resolv.conf
# add `nameserver 8.8.8.8` on the top of the list
# also check if the config file is managed by /sbin/dhclient-script or other daemon
# simply reboot once and see if the config persists
# If the config is being managed, and you don't want the config being overwritten
# do
sudo chattr +i /etc/resolv.conf
@samson-sham
samson-sham / install.sh
Created April 1, 2021 08:21
wget download and md5 checking
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz.md5
md5sum -c ffmpeg-release-amd64-static.tar.xz.md5
tar xvf ffmpeg-release-amd64-static.tar.xz
sudo apt install ntpdate
sudo ntpdate pool.ntp.org
@samson-sham
samson-sham / CACertInstallation.sh
Last active August 3, 2021 04:48
Adding CA certificate to the system trusted CA repo
# https://askubuntu.com/questions/645818/how-to-install-certificates-for-command-line
sudo mkdir /usr/local/share/ca-certificates/app
sudo cp RootCertificate.crt /usr/local/share/ca-certificates/app/
sudo chmod 755 /usr/local/share/ca-certificates/app
sudo chmod 644 /usr/local/share/ca-certificates/app/RootCertificate.crt
@samson-sham
samson-sham / certbot
Last active September 29, 2020 17:29
/etc/cron.d/certbot
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc. Renewal will only occur if expiration
# is within 30 days.
#
# Important Note! This cronjob will NOT be executed if you are
# running systemd as your init system. If you are running systemd,