Skip to content

Instantly share code, notes, and snippets.

View zhouqt's full-sized avatar

Tom Zhou zhouqt

  • Canonical, Ltd.
  • Beijing, China
  • 14:42 (UTC +08:00)
View GitHub Profile
@nitred
nitred / optimal_mtu.md
Last active June 19, 2024 22:47
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
#!/usr/bin/gawk -f
#
# Usage: ./rabbit-tell.awk <rabbitmqctl_report>
#
# Common RabbitMQ issues that this script can be used to identify
#
# - Partitioned cluster
#
# - High binary/queue memory usage. There are mainly two causes of this:
#
@rodrigogansobarbieri
rodrigogansobarbieri / recover_machine_agents.py
Last active March 30, 2023 03:46 — forked from g-ramirez/recover_machine_agents.py
Recover juju machine agents
#!/usr/bin/env python3
"""
This is a tool for recovering lost machine units in current model
Usage:
{0} model-name dest-dir
"""
# changes summary:
# added logic to prevent overwrite /var/lib/juju to avoid removing non-machine units
@wedi
wedi / autoinstaller_minimal.sh
Last active January 27, 2021 14:33
Test Ubuntu nocloud autoinstaller with Virtualbox
#!/bin/sh
VM_NAME=UbuntuAutoinstall
UBUNTU_ISO="$PWD/ubuntu-groovy-live-server-amd64.iso"
UBUNTU_DOWNLOAD_URL=http://cdimage.ubuntu.com/ubuntu-server/daily-live/current/groovy-live-server-amd64.iso
set -eux
[[ ! -e "$UBUNTU_ISO" ]] && wget -O "$UBUNTU_ISO" $UBUNTU_DOWNLOAD_URL
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active June 20, 2024 06:26
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@yougg
yougg / proxy.md
Last active June 20, 2024 00:39
complete ways to set http/socks/ssh proxy environment variables

set http or socks proxy environment variables

# set http proxy
export http_proxy=http://PROXYHOST:PROXYPORT

# set http proxy with user and password
export http_proxy=http://USERNAME:PASSWORD@PROXYHOST:PROXYPORT

# set http proxy with user and password (with special characters)
@phuysmans
phuysmans / gist:4f67a7fa1b0c6809a86f014694ac6c3a
Created January 8, 2018 09:29
docker compose health check example
version: '2.1'
services:
php:
tty: true
build:
context: .
dockerfile: tests/Docker/Dockerfile-PHP
args:
version: cli
volumes:
@cezarignat
cezarignat / selfsign-vmware-modules.sh
Last active November 1, 2023 15:09
Self sign the required modules, vmmon and vmnet, for VMWARE to work with SecureBoot on, Ubuntu 17
#!/bin/sh
#Asking for sudo because the script needs it almost all the time
sudo echo -n
#Creating the key used to sign the two modules
echo 'Preparing vmware key...'
openssl req -new -x509 -newkey rsa:2048 -keyout VMWAREKEY.priv -outform DER -out VMWAREKEY.der -nodes -days 36500 -subj "/CN=VMware/"
#Sign the modules
#!/bin/sh
#----
# bootstrap fedora18
#release=$(cat /etc/fedora-release | awk '/^Fedora/ {print $3}')
#arch=$(arch)
release=18
arch=x86_64
ROOTFS=/var/lib/libvirt/lxc/fedora$release-$arch