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_zsh_all_in_one.md
Last active April 29, 2025 09:46
How to install Zsh, Oh-my-zsh, powerlevel10k and zsh plugins on Ubuntu

Howto install Zsh, Oh-my-zsh, powerlevel10k and zsh plugins on Ubuntu

Install zsh

sudo apt install zsh -y

Install Oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Download and install necessary fonts

@nhthai2005
nhthai2005 / Autocomplete_ssh_scp.md
Last active January 7, 2025 10:17
Autocomplete server names for SSH and SCP for Git Bash

Autocomplete server names for SSH and SCP for Git Bash

For ssh

1. Make a file with name ssh as following content:

_ssh() 
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
@nhthai2005
nhthai2005 / install_necessary_tools_ubuntu.sh
Last active December 28, 2023 23:16
Howto Install necessary tools 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 / 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 / chroot.md
Created March 13, 2023 22:47
Login from Live Disk and Fix a Broken Bootloader Using Chroot

Login from Live Disk (Chroot)

lsblk

sudo mount /dev/nvme0n1p3 /mnt
sudo cryptsetup luksOpen /dev/nvme0n1p3 cryptdata

sudo lvscan
sudo vgchange -ay
@nhthai2005
nhthai2005 / vcard.html
Last active December 13, 2022 07:08
vCard HTML Template. Designed by Nguyen Hong Thai
<html>
<head>
<!--vCard HTML Template. Designed by Nguyen Hong Thai
Go to https://nhthai2005.github.io/contacts.htm to see demo-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nguyễn Hồng Thái (Shant) - Name Card - vCard via Links and QR</title>
<link rel="shortcut icon" type="image/png" href="data/nguyen-hong-thai-circle-cropped.png">
<style>
@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
.avatar {
@nhthai2005
nhthai2005 / pg_upgrade_9.6_to_13.sh
Last active October 16, 2022 03:57
Migration postgres data from 9.6 to 14
#!/bin/bash
# MAINTAINER: NGUYEN HONG THAI
if [ $# -eq 2 ]; then
old_data=$(realpath $1)
new_data=$(realpath $2)
else
read -p "old_data: " old_data
old_data=$(realpath $old_data)

How to run Docker inside LXD containers

Create LXD Container

Docker will not run well with the default zfs file system

lxc storage create docker btrfs
lxc launch images:ubuntu/20.04 demo
lxc storage volume create docker demo
lxc config device add demo docker disk pool=docker source=demo path=/var/lib/docker
lxc config set demo security.nesting=true security.syscalls.intercept.mknod=true security.syscalls.intercept.setxattr=true
@nhthai2005
nhthai2005 / Postman.desktop
Created June 24, 2022 05:56
Add icon to Application menu ~/.local/share/applications
[Desktop Entry]
Name=Postman
Comment=MyPostman
Exec=/home/admin/Apps/Postman/Postman
Icon=/home/admin/Apps/Postman/postman.png
Terminal=false
Type=Application
StartupNotify=true
@nhthai2005
nhthai2005 / ViM column mode edit.md
Last active June 7, 2022 05:38
vim: quick column insert

To use ViM(Vi) column mode edit use following commands.

  • Ctrl + v column mode edit command
  • Select the columns, rows (h,j,k,l)
  • Shift + i to go into insert mode in column mode
  • Type in desired text. At the time of typing only ONE row is changed, showed
  • Press the Esc key to apply the changes to the selected column

Reference: http://www.uni-koeln.de/~pbogusze/posts/ViM_column_mode_edit.html

Indent multiple lines quickly in vi: