Skip to content

Instantly share code, notes, and snippets.

View moismailzai's full-sized avatar

Mo Ismailzai moismailzai

View GitHub Profile
@moismailzai
moismailzai / export_for_wfs.sh
Created June 5, 2022 06:03
Export your current linux system for use with WSL
#!/bin/sh -eux
if [ "$(whoami)" != "root" ]
then
sudo su -s "$0"
exit
fi
# truncate any logs that have built up during the install
find /var/log -type f -exec truncate --size=0 {} \;
@moismailzai
moismailzai / 0x5f3759df-quake-iii-arena-s-fast-inverse-square-root-function-explained.markdown
Last active October 25, 2022 07:38
0x5f3759df - Quake III Arena's Fast Inverse Square Root Function Explained
@moismailzai
moismailzai / wgjailr
Created February 9, 2023 22:19
Creates, destroys, or runs commands in a wireguard jail. Configure the variables up top to point to your wireguard configuration. Run like "wgjairl up|down|exec".
#!/bin/bash
# forked from https://www.wireguard.com/netns/#the-new-namespace-solution & expanded by mo@ismailzai.com ###############
# CONFIGURABLE #########################################################################################################
ALL_PHYSICAL_INTERFACES=(enp6s0)
ALL_WIRELESS_INTERFACES=()
NETWORK_NAMESPACE_NAME=proton
VPN_CONFIG_PATH=/tank/opt/nas1-config/vpn/proton_us_ca_72.conf
VPN_DNS_SERVER=10.2.0.1
@moismailzai
moismailzai / netns-proton.service
Created February 9, 2023 22:21
systemd unit to run the wireguard jail as a service. see notes at the bottom.
# forked from https://etherarp.net/network-isolation-of-services-with-systemd/index.html
# ln -s /path/to/this/file /usr/lib/systemd/system/netns-proton.service
[Unit]
After=zfs-mount.service
Description=Named network namespace "proton"
StopWhenUnneeded=true
[Service]
Type=oneshot
RemainAfterExit=yes