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 / 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 / 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:

@nhthai2005
nhthai2005 / sources.list_debian.txt
Created May 18, 2022 15:04
Howto make apt udpate online on debian
# deb cdrom:[Debian GNU/Linux 11.3.0 _Bullseye_ - Official amd64 DVD Binary-1 20220326-11:23]/ bullseye contrib main
deb http://security.debian.org/debian-security bullseye-security main contrib
deb-src http://security.debian.org/debian-security bullseye-security main contrib
# bullseye-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
@nhthai2005
nhthai2005 / Common_SSH_CLI.md
Last active May 22, 2022 01:28
Common SSH Command Line

Common SSH Command Line

Generate a strong SSH key

  • RSA: ssh-keygen -o -t rsa -b 8192 -C marco.franssen@macbook-pro
  • Ed25519: ssh-keygen -t ed25519 -a 64 -C marco.franssen@macbook-pro

Ed25519: It’s the most recommended public-key algorithm available today! It has a 256-bit length and gives equal if not better protections as a 4096-bit RSA key. Reference: https://marcofranssen.nl/upgrade-your-ssh-security

Add passphrass into existing ssh key

  • Add passphrase: ssh-keygen -p -f ~/.ssh/id_rsa
  • Verify it: ssh-keygen -y -f ~/.ssh/id_rsa
@nhthai2005
nhthai2005 / fix_bugs_ubuntu_22.04.md
Last active May 7, 2022 03:05
Howto fix bugs on Ubuntu 22.04 LTS

Howto fix bugs on Ubuntu 22.04 LTS

Face up the black screen when recording screen with Kazam and OBS Studio

Fix it by disabling Wayland

  • Comment out WaylandEnable=false in /etc/gdm3/custom.conf
  • Logout and login again

Cannot ssh on Ubuntu 22.04 LTS

After connected OpenVPN Server, then can ping, but cannot ssh ssh-bug Add MACs hmac-sha2-256 into /etc/ssh/ssh_config or ~/.ssh/config as a workaround

@nhthai2005
nhthai2005 / Install_Python_on_Linux.md
Created May 6, 2022 06:51
Howto Install Python on Linux

Install Python on Linux

To install the latest version of Python on Debian-based Linux distributions, you can create a new terminal (Ctrl + Alt + T) and run the following commands:

sudo apt-get update
sudo apt-get install python3 python3-venv python3-pip

For Fedora-based Linux distributions, you can run the following:

sudo dnf install python3
@nhthai2005
nhthai2005 / update_keepass_ubuntu.md
Last active May 8, 2022 14:41
Howto update KeePass up to latest version on Ubuntu

Howto update KeePass up to latest version on Ubuntu

Install keepass2 on Ubuntu

sudo apt install keepass2

Download KeePass with the latest version

Goto https://keepass.info/download.html and download KeePass Portable (zip file) or use the following command:

curl -Lo KeePass.zip https://sourceforge.net/projects/keepass/files/KeePass%202.x/2.51/KeePass-2.51.zip/download

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 / install_zsh_all_in_one.md
Last active April 12, 2024 12:42
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