Skip to content

Instantly share code, notes, and snippets.

View mwyau's full-sized avatar

Albert Yau mwyau

View GitHub Profile
@mwyau
mwyau / wordle.json
Created September 28, 2024 18:17
Wordle
[
"aahed",
"aalii",
"aapas",
"aargh",
"aarti",
"abaca",
"abaci",
"abacs",
"abaft",
@mwyau
mwyau / dfree-zfs
Last active May 25, 2021 03:11
dfree-zfs for Samba ZFS pools
#!/bin/bash
POOLS=$(df -PT | awk '$2~"zfs" && $7~path {print $1}' path="^$(realpath ${1:-/mnt})" | awk -F'/' '{print $1}' | sort | uniq)
USED=0
AVAIL=0
for pool in ${POOLS[@]}; do
(( USED += $(zfs get -o value -Hp used $pool) ))
(( AVAIL += $(zfs get -o value -Hp available $pool) ))
@mwyau
mwyau / etc-samba-smb.conf
Created May 23, 2021 16:03 — forked from steveh/etc-samba-smb.conf
Samba dfree and zfs on Ubuntu 14.04
# File: /etc/samba/smb.conf
dfree command = /usr/local/bin/dfree
@mwyau
mwyau / config
Last active March 4, 2019 20:06
SSHFP ~/.ssh/config
Host *
VerifyHostKeyDNS yes
@mwyau
mwyau / ubuntu-18.04-l2tp-ipsec-vpn.md
Last active March 4, 2019 18:19
Ubuntu 18.04 L2TP/IPSec VPN

Ubuntu 18.04 L2TP/IPSec VPN

  • Install network-manager-l2tp-gnome

    $ sudo apt install network-manager-l2tp-gnome

  • Add the L2TP connection in Network Manager and set the Pre-shared key, Phase1 and Phase2 Algorithms:

    Phase1 Algorithms : 3des-sha1-modp1024

[Pi-hole]
title=Pi-hole
description=Pi-hole
ports=53,80/tcp|53/udp
@mwyau
mwyau / install.sh
Created March 3, 2019 04:52
ddclient 3.9.0
wget https://github.com/ddclient/ddclient/archive/v3.9.0.tar.gz -O ddclient-3.9.0.tar.gz
tar zxvf ddclient-3.9.0.tar.gz
cd ddclient-3.9.0
sudo cp ddclient /usr/sbin/
sudo mkdir /etc/ddclient
sudo mkdir /var/cache/ddclient
sudo vim /etc/ddclient/ddclient.conf
sudo cp sample-etc_rc.d_init.d_ddclient.ubuntu /etc/init.d/ddclient
sudo update-rc.d ddclient defaults
sudo apt install libio-socket-ssl-perl libdata-validate-ip-perl libjson-pp-perl
@mwyau
mwyau / README.md
Last active November 2, 2018 21:16
Windows/Ubuntu Multi-boot Bluetooth Mouse

In Windows

psexec.exe -s -i regedit /e C:\BTKeys.reg HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Keys

In Ubuntu

sudo vim /var/lib/bluetooth/[MAC]/info
@mwyau
mwyau / 02-fixresolvconf.sh
Last active November 2, 2018 15:37
/etc/NetworkManager/dispatcher.d/02-fixresolvconf.sh
#!/bin/sh -e
# Fix the permission of systemd-resolved resolv.conf after disconnected from
# VPN in Ubuntu 18.04
if [ "$2" = "vpn-down" ]; then
chmod 644 /run/systemd/resolve/stub-resolv.conf
chown systemd-resolve:systemd-resolve /run/systemd/resolve/stub-resolv.conf
fi
@mwyau
mwyau / docker_run.sh
Last active October 27, 2018 00:32
Pi-Hole Docker script
#!/bin/bash
# Just hard code these to your docker server's LAN IP if lookups aren't working
IP="192.168.1.2" # use $IP, if set, otherwise IP_LOOKUP
# Default of directory you run this from, update to where ever.
DOCKER_CONFIGS="$(pwd)"
echo "### Make sure your IPs are correct, hard code ServerIP ENV VARs if necessary\nIP: ${IP}\nIPv6: ${IPv6}"