Skip to content

Instantly share code, notes, and snippets.

View tienthanh2509's full-sized avatar

Phạm Tiến Thành tienthanh2509

View GitHub Profile
@tienthanh2509
tienthanh2509 / Caddyfile
Created July 15, 2021 11:07
Caddy example reverve proxy
# Hide original hostname, skip ssl check destination host, remove forwarded ip/protocol, http only
http://example.com {
reverse_proxy {
to https://1.2.3.4
header_up -X-Forwarded-For
header_up -X-Forwarded-Proto
header_up -Host
header_up Host httpbin.net
transport http {
@tienthanh2509
tienthanh2509 / fortigate-ipv6.md
Last active May 7, 2023 02:22
Enabling IPv6 with DHCPv6-PD and PPPoE on a Fortigate

Log into your Fortigate with SSH and enter the vdom context you are using then edit the WAN interface:

Assumtion

  • wan1 is for pppoe port
  • internal internal switch
  • vlan30 guest vlan
config system interface
@tienthanh2509
tienthanh2509 / create_vmdk_disk.sh
Last active April 22, 2021 09:29
Vagrant virtualbox cloud-init
# Default Vagrant with cloud-init will create 2 difference config disk
# iso: our config data, but store in /tmp, will lost if host machine restart, cause boot failure for VM
# vmdk: default, store in same vm folder
dd if=vagrant20210422-1455709-cdqm7s.iso of=cloud-init.iso bs=10M conv=sync
VBoxManage convertfromraw --format vmdk cloud-init.iso cloud-init.vmdk
VBoxManage internalcommands sethduuid cloud-init.vmdk
# Now remove xxxyyy-cloudimg-configdrive.vmdk by cloud-init.vmdk
@tienthanh2509
tienthanh2509 / build.sh
Created April 21, 2021 05:29
build padavan rt-n56u
export http_proxy=http://10.10.10.10:8080/
export https_proxy=http://10.10.10.10:8080/
mkdir -p /etc/systemd/system/docker.service.d
cat << EOF > /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment="HTTP_PROXY=http://10.10.10.10:8080/"
Environment="HTTPS_PROXY=http://10.10.10.10:8080/"
EOF
@tienthanh2509
tienthanh2509 / squid.conf
Last active December 22, 2021 13:42
SQUID3 config with upstream proxy
# Squid 3
#
# Sample config
# - use upstream proxy 10.10.10.10:8080
# - Allow 192.168.56.0/24 access
# - Direct access for gitlab.com, github.com
http_port 192.168.56.1:3128
icp_port 0
dns_v4_first on
@tienthanh2509
tienthanh2509 / dnsmasq.conf
Created February 15, 2021 11:20
Additional subnet/interface for dnsmasq
# Guest network
interface=interface:br-guest
listen-address=192.168.3.1
dhcp-range=interface:br-guest,192.168.3.50,192.168.3.250,255.255.255.0,1h
dhcp-option=interface:br-guest,6,8.8.8.8,8.8.4.4
dhcp-option=interface:br-guest,15,guest.pt-infra.net
@tienthanh2509
tienthanh2509 / g_ether.conf
Created January 12, 2021 10:26
Enable g_ether for Raspberry Pi
# Set mac address
options g_ether host_addr=e6:ac:a4:6c:9c:99
@tienthanh2509
tienthanh2509 / time.sh
Created December 21, 2020 07:03
Set time from internet without NTP server
#!/bin/
#
date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
hwclock -w
@tienthanh2509
tienthanh2509 / nagios-nrpe.sh
Created November 9, 2020 03:37
Install newer nagios nrpe server on ubuntu
#!/bin/bash
# Tested with bionic/focal
cd /tmp
# Try download latest pkg from launchpad
wget -o nagios-nrpe-server_4.0.3-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+source/nagios-nrpe/4.0.3-1ubuntu1/+build/19500268/+files/nagios-nrpe-server_4.0.3-1ubuntu1_amd64.deb
# Install it
dpkg -i nagios-nrpe-server_4.0.3-1ubuntu1_amd64.deb
@tienthanh2509
tienthanh2509 / install_firefox.md
Created November 5, 2020 07:21
Replace Linux Mint firefox by Ubuntu Firefox
  1. Remove Mint version of Firefox.

  2. In directory /etc/apt/preferences.d create file firefox.pref (or any other name) with content:

Package: firefox firefox-locale-*
Pin: release o=Ubuntu
Pin-Priority: 800