Skip to content

Instantly share code, notes, and snippets.

View vancanhuit's full-sized avatar
🎯
Focusing

Canh Dinh vancanhuit

🎯
Focusing
View GitHub Profile
@vancanhuit
vancanhuit / ca.json
Last active August 18, 2024 15:04
Smallstep CA configuration
{
"root": "/etc/step-ca/certs/root_ca.crt",
"federatedRoots": null,
"crt": "/etc/step-ca/certs/intermediate_ca.crt",
"key": "/etc/step-ca/secrets/intermediate_ca_key",
"address": ":443",
"insecureAddress": "",
"dnsNames": [
"ca.lab.internal"
],
@vancanhuit
vancanhuit / selinux-incus-agent.sh
Last active September 11, 2024 13:04
Handling SELinux for incus-agent on Red Hat based VMs
# https://github.com/lxc/incus/commit/b2cd793ae4ce016ca7da128cc2d14544c041c801
# https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/using_selinux/changing-selinux-states-and-modes_using-selinux#enabling-selinux-on-systems-that-previously-had-it-disabled_changing-selinux-states-and-modes
semanage fcontext -a -t bin_t /var/run/incus_agent/incus-agent
restorecon -R /run/incus_agent
fixfiles -F onboot
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
indent_style = space
indent_size = 4
@vancanhuit
vancanhuit / apply-network-config.sh
Last active April 13, 2024 15:44
Incus/LXD: cloud-init static ip for containers and VMs
cat cloud-init-static-ip-container.yaml | incus config set <name> cloud-init.network-config -
cat cloud-init-static-ip-vm.yaml | incus config set <name> cloud-init.network-config -
@vancanhuit
vancanhuit / create-instance.sh
Last active August 18, 2024 08:57
Incus/LXD RHEL-based distro profile for a basic initialization
incus launch images:rockylinux/9/cloud test --profile rhel
incus launch images:rockylinux/9/cloud test-vm --vm --profile rhel --profile vm-config
@vancanhuit
vancanhuit / init.lua
Last active April 21, 2024 02:24
Neovim Lua configuration
vim.opt.number = true
vim.opt.mouse = 'a'
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.wrap = true
vim.opt.breakindent = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.smarttab = true
@vancanhuit
vancanhuit / .tmux.conf
Last active March 16, 2024 03:59
TMUX configuration
set -s default-terminal "tmux-256color"
set -as terminal-overrides ",xterm*:Tc"
set -s escape-time 0
set -g history-limit 50000
set -g display-time 1000
set -g mode-keys vi
set -g base-index 1
set -g pane-base-index 1
set -g automatic-rename off
@vancanhuit
vancanhuit / linux-networking.md
Last active January 17, 2021 08:03
DNS in Linux

DNS

# /etc/hosts
# /etc/resolv.conf
# /etc/nsswitch.conf
$ nslookup google.com
$ dig facebook.com

Switching and Routing

@vancanhuit
vancanhuit / Vagrantfile-internal-network
Last active January 2, 2021 11:21
Simple vagrant setup with internal network.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "vancanhuit/debian10"
config.vm.base_mac = nil
config.vm.define "node1" do |node|
node.vm.hostname = "node1"
node.vm.network "private_network", ip: "192.168.10.5", virtualbox__intnet: "inet1"

x86-64 Integer Registers

# 64-bit 32-bit 16-bit 8-bit
1 %rax %eax %ax %al Return value
2 %rbx %ebx %bx %bl Callee saved
3 %rcx %ecx %cx %cl 4th argument
4 %rdx %edx %dx %dl 3th argument
5 %rsi %esi %si %sil 2nd argument
6 %rdi %edi %di %dil 1st argument