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 / 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 / quick-setup-git.md
Last active May 31, 2021 04:33
Quick setup — if you’ve done this kind of thing before

Quick setup — if you’ve done this kind of thing before

Supposed that https://github.com/nhthai2005/DNS-Server.git Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.

...create a new repository on the command line

echo "# DNS-Server" >> README.md git init git add README.md git commit -m "first commit" git branch -M master

@nhthai2005
nhthai2005 / Docker-Commands.md
Created May 31, 2021 04:32
Some Important Docker Commands

Some Important Commands

1. Use to start a stopped node

docker-machine start node_name;                 

2. Use to stop a running node

docker-machine stop node_name;                 

3. Use to check docker nodes

docker-machine ls;                                         

4. Use to check ip of a node

docker-machine ip node_name;                     

5. Use to check node list

@nhthai2005
nhthai2005 / Vagrantfile
Created June 2, 2021 00:05
Build Ansible by vagrant
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.vm.box = "centos/7"
config.vm.network "private_network", ip: "192.168.99.2"
config.vm.hostname = "ansible"
config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
config.vm.provider "virtualbox" do |vb|
vb.name = "Ansible-Playbooks"
vb.cpus = 2
vb.memory = "4096"
@nhthai2005
nhthai2005 / checksum.md
Last active June 2, 2021 00:35
Finding Checksum Values in Windows 10

Finding Checksum Values in Windows 10

One method uses the command certutil in the command prompt window. For example:

certutil -hashfile c:\Users\JDoe\Desktop\abc.exe SHA512

This command returns the SHA512 hash of file abc.exe located at the specified file path. You may use other values after SHA, such as 1 or 256, to produce the corresponding hash, and you may substitute MD5 or other supported parameters.

Another method is to use Windows PowerShell (version 5.1 for me) with the command Get-FileHash:

@nhthai2005
nhthai2005 / install_docker-compose.sh
Created June 3, 2021 01:32
Install Docker Compose
#!/bin/bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
@nhthai2005
nhthai2005 / remove_CTRL-M_^M.md
Last active June 4, 2021 15:00
How to remove CTRL-M (^M) characters from a file in Linux

The simplest solution, use the dos2unix command (sometimes named fromdos, d2u or unix2dos):

dos2unix filename

Using the stream editor sed:

sed -e "s/\r//g" file > newfile

Using perl:

perl -p -e 's/\r//g' file > newfile

Using a terminal editor vi or vim:

@nhthai2005
nhthai2005 / postgres-cheatsheet.md
Created June 5, 2021 03:46 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@nhthai2005
nhthai2005 / Windows-Terminal-Shortcut.md
Last active June 8, 2021 02:12
Split Panes for Multiple Shells at Once

Split Panes for Multiple Shells at Once

Split Panes

Here are some other keyboard shortcuts for working with panes:

  • Create a new pane, splitting horizontally: Alt+Shift+- (Alt, Shift, and a minus sign)
  • Create a new pane, splitting vertically: Alt+Shift++ (Alt, Shift, and a plus sign)
  • Move pane focus: Alt+Left, Alt+Right, Alt+Down, Alt+Up
  • Resize the focused pane: Alt+Shift+Left, Alt+Shift+Right, Alt+Shift+Down, Alt+Shift+Up
  • Close a pane: Ctrl+Shift+W
@nhthai2005
nhthai2005 / .inputrc
Created June 12, 2021 04:58
How to cycle through reverse-i-search in BASH?
# How to cycle through reverse-i-search in BASH?
# vi ~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward