Skip to content

Instantly share code, notes, and snippets.

View nhthai2005's full-sized avatar

Thai H. NGUYEN (Bob) nhthai2005

View GitHub Profile
@nhthai2005
nhthai2005 / install_tools_ubuntu.sh
Last active December 28, 2023 23:05
Install neccessary tools and configure something on Ubuntu
#!/bin/bash
sudo add-apt-repository ppa:bamboo-engine/ibus-bamboo
sudo apt-get update
# Install all necessary tools with the following command
sudo apt install vim htop terminator meld glogg curl git totem keepass2 \
kazam ksnip maven remmina libreoffice network-manager-l2tp-gnome \
ibus-bamboo gnome-calendar gnome-weather gnome-clocks \
qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager -y; \
@nhthai2005
nhthai2005 / howto-make-usb-boot.md
Last active May 1, 2022 08:54
How to create a bootable Ubuntu USB flash drive from terminal

How to create a bootable Ubuntu USB flash drive from terminal

List devices

sudo fdisk -l

Create a bootable Ubuntu flash drive with dd method

sudo dd bs=4M if=ubuntu-22.04-desktop-amd64.iso of=/dev/sda status=progress oflag=sync

@nhthai2005
nhthai2005 / update-grub_from_LiveCD.md
Last active April 22, 2022 20:34
How do I run update-grub from a LiveCD

Howto update-grub from LiveCD

1. List partitions to know which partition is root (/) and mount it

lsblk
sudo mount /dev/sda5 /mnt
Then mount a few more directories that are needed:
sudo mount --bind /dev /mnt/dev
@nhthai2005
nhthai2005 / minikube-portforward.md
Last active April 16, 2022 10:13
How to configure port-forward for minikube

How to configure port-forward for minikube

Create minikube-portforward, conf.d and ssl

mkidr minikube-portforward
cd minikube-portforward
mkdir conf.d ssl

Download minikube_portforward.conf and docker-compose.yml

@nhthai2005
nhthai2005 / nginx-port-forward.md
Last active April 18, 2022 08:00
Howto Configure port-forward using nginx

Howto Configure port-forward using nginx

Create nginx-portforward directory

mkdir nginx-portforward && cd nginx-portforward

Download nginx-portforward.conf and nginx-portforward.yml

curl -LO https://gist.githubusercontent.com/nhthai2005/8993478b4d898ddf499ed50411d75c44/raw/18712ed7232a9b07c9bba1439474a1329d802fcd/nginx-portforward.conf
curl -LO https://gist.githubusercontent.com/nhthai2005/8993478b4d898ddf499ed50411d75c44/raw/18712ed7232a9b07c9bba1439474a1329d802fcd/nginx-portforward.yml
@nhthai2005
nhthai2005 / curl-smtp-email.sh
Last active April 16, 2022 10:08 — forked from james2doyle/curl-smtp-email.sh
Send SMTP email using cURL
curl --connect-timeout 15 -v --insecure "smtp://smtp.example.com:25" -u "username:password" \
--mail-from "sender@example.com" --mail-rcpt "destination@example.com" \
-T email-contents.txt --ssl
@nhthai2005
nhthai2005 / send-an-email-with-curl
Created April 15, 2022 10:24 — forked from rohan-molloy/send-an-email-with-curl
How to use cURL to send an email
curl \
--silent \
--ssl smtp://$SERVER \
--mail-from $FROM \
--mail-rcpt $TO \
--upload-file /dev/stdin \
--user $USER:$PASSWORD
@nhthai2005
nhthai2005 / setup_docker_mailserver.md
Created April 15, 2022 04:04
Setup Mail Server đơn giản với docker

Setup Mail Server đơn giản với docker

git clone https://github.com/jeboehm/docker-mailserver.git
cd docker-mailserver/
cp -p .env.dist .env
bin/production.sh pull
bin/production.sh up -d
docker-compose ps
bin/production.sh run --rm web setup.sh
@nhthai2005
nhthai2005 / expand_swap_partition_LVM_LUKS.txt
Last active April 13, 2022 05:32
How to expand swap partition after system installation
# How to expand swap partition after system installation
# Supposed that installing Ubuntu with LVM and Encrypted with LUKS default. So, current swap is 1G and /dev/sda4 is encrypted. You want to add +3G to become +4G.
# Open encrypted partition, it is /dev/sda4 in this case
sudo cryptsetup luksOpen /dev/sda4 encrypted
sudo vgscan
sudo vgchange --activate y vgubuntu
sudo pvs
sudo vgs
sudo lvs
@nhthai2005
nhthai2005 / install_ansible_ubuntu.sh
Last active April 10, 2022 04:46
Howto install ansible on Ubuntu
#!/bin/bash
# Howto install ansible on Ubuntu
python3 -m venv ansible
# if Debian/Ubuntu, then:
# sudo apt install python3.10-venv
# python3.10 -m venv ansible
# To access your project