Skip to content

Instantly share code, notes, and snippets.

View bouroo's full-sized avatar
🏠
Remote Working

Kawin Viriyaprasopsook bouroo

🏠
Remote Working
View GitHub Profile
@bouroo
bouroo / pve.md
Last active January 6, 2024 18:50
PVE cmd memo

First run

# vmbr0 => public
# vmbr1 => private => mtu 8996
# disable PVE enterprise repo
# enable PVE no-subscription
# enable debian non-free repo
apt update && apt -y full-upgrade && apt -y install intel-microcode
apt -y install openvswitch-switch tmux htop curl wget jq rsync rclone mtr-tiny net-tools iperf3
# Enable auto update
@bouroo
bouroo / cloudflare-add-dns.sh
Last active December 9, 2023 18:15
Cloudflare bash add Sites/DNS record
#!/usr/bin/env bash
# Require curl & jq
hash curl 2>/dev/null || { echo >&2 "I require 'curl' but it's not installed. Aborting."; exit 1; }
hash jq 2>/dev/null || { echo >&2 "I require 'jq' but it's not installed. Aborting."; exit 1; }
# Get domain list
read -e -i 'domains.csv' -p 'Domain list file: ' DOMAIN_FILE
read -e -i 'y' -p 'CF Proxy [Y/n]: ' CF_PROXY
if [[ ${CF_PROXY} =~ ^([yY][eE][sS]|[yY])+$ ]]
@bouroo
bouroo / directadmin-add-domain.sh
Last active December 9, 2023 18:15
Bulk Add Domains To DirectAdmin
#!/usr/bin/env bash
# Require curl & jq
hash curl 2>/dev/null || { echo >&2 "I require 'curl' but it's not installed. Aborting."; exit 1; }
hash jq 2>/dev/null || { echo >&2 "I require 'jq' but it's not installed. Aborting."; exit 1; }
# Get user infos
read -e -i 'http://domain.com:2222' -p 'DA URL: ' DA_URL
read -p 'DA User: ' DA_USER
read -sp 'DA Password: ' DA_PASS
@bouroo
bouroo / openvpn.sh
Created June 29, 2019 09:51
Install OpenVPN from OpenVPN project's own software repositories
#!/usr/bin/env bash
if [ "$(whoami)" != "root" ]; then
SUDO=sudo
fi
if ! $(type lsb_release > /dev/null 2>&1) ; then
${SUDO} apt install -y lsb-release
fi
@bouroo
bouroo / ssl.sh
Last active December 9, 2023 18:14
self sign cert script
#!/usr/bin/env bash
sudo rm -f ~/.rnd
if grep -qs "CentOS release 5" "/etc/redhat-release"; then
echo "CentOS 5 is too old and not supported"
exit
fi
if ! hash openssl 2>/dev/null; then\
echo "Required openssl"
exit
@bouroo
bouroo / docker-nginx-http3.sh
Last active December 9, 2023 18:10
docker-nginx-http3
#!/usr/bin/env bash
#==============================================================================
# title: docker-nginx-http3.sh
# description: build nginx http3 support from https://github.com/patrikjuvonen/docker-nginx-http3
# author: Kawin Viriyaprasopsook <kawin.v@kkumail.com>
# usage: bash docker-nginx-http3.sh
# notes: need `docker curl git` packages
#==============================================================================
git clone https://github.com/patrikjuvonen/docker-nginx-http3.git tmp
@bouroo
bouroo / autoupdate_da.sh
Last active December 9, 2023 18:07
Update directadmin webserver and add some security
#!/usr/bin/env bash
wget -O /usr/local/directadmin/scripts/getDA.sh https://gist.github.com/bouroo/6ffbb5afe99acdf975d0664f2e6970f6/raw/a7028ed7fb57da830b0e5d7b2678cc18527d0cf0/getDA.sh && \
/usr/local/directadmin/scripts/getDA.sh stable && \
sleep 5 && \
/usr/local/directadmin/directadmin set update_channel stable && \
/usr/local/directadmin/directadmin config-set autoupdate 1 && \
/usr/local/directadmin/scripts/getLicense.sh auto && \
service directadmin restart
exit 0
@bouroo
bouroo / kea-dhcp.sh
Last active December 3, 2023 18:26
Install kea DHCP server from source on ubuntu
#!/usr/bin/env bash
# Define variable
KEA_VER="v1_8_0"
CPU_CORES=$(grep -c processor /proc/cpuinfo)
if [ ${CPU_CORES} -gt 1 ]; then
CPU_CORES=$((CPU_CORES - 1))
fi
if [ "$(whoami)" != "root" ]; then
SUDO=sudo
@bouroo
bouroo / install_go.sh
Last active November 30, 2023 15:34
Get latest version of go lang
#!/usr/bin/env bash
#
# Script: install_go.sh
#
# Description:
# This script automates the installation of the Go programming language for various architectures
# and major operating systems. It detects the system architecture and OS to download the
# appropriate Go binary and sets up the necessary environment variables.
#
# Usage:
@bouroo
bouroo / resize_disk.sh
Created November 10, 2023 07:31
linux extend disk partition script
#!/usr/bin/env bash
# find root path
ROOT_DEV=$(findmnt -n -o SOURCE /)
# rescan disk size
echo 1 | sudo tee /sys/block/sda/device/rescan
# grow partition that contains root
# extend partition size
growpart /dev/sda 3
# extend physical volume
pvresize /dev/sda3