Skip to content

Instantly share code, notes, and snippets.

View mhou1981's full-sized avatar
🖥️

Michael mhou1981

🖥️
  • Vancouver, BC, Canada
View GitHub Profile
@mhou1981
mhou1981 / gist:0c354ad2ad95246fd7da8e9702697f30
Created July 13, 2023 06:32
Zencastr whitelist URL for MalewareBytes
recording.zencastr.com
zen.ai
www.zencastr.com
@mhou1981
mhou1981 / x11-forward-for-sudo.sh
Created March 22, 2021 01:05
Add X11 forward to sudo
#!/bin/bash
sudo touch /root/.Xauthority
sudo xauth add $(xauth -f ~${USER}/.Xauthority list | tail -1)
ls ./ | xargs -n1 -P10 -I% rsync -e 'ssh -q' -Pa % user@host:path/
#!/bin/bash
# Put this shell script under /etc/letsencrypt/renewal-hooks/post to auto update plex SSL with Let's Encrypt.
HOSTNAME="$(hostname -f)"
openssl pkcs12 -export -out /var/lib/plexmediaserver/certificate.pfx -inkey /etc/letsencrypt/live/${HOSTNAME}/privkey.pem -in /etc/letsencrypt/live/${HOSTNAME}/cert.pem -certfile /etc/letsencrypt/live/${HOSTNAME}/chain.pem -passout pass:
chown plex:plex /var/lib/plexmediaserver/certificate.pfx
sleep 5
systemctl restart plexmediaserver.service
@mhou1981
mhou1981 / df_command_exp.sh
Last active July 29, 2019 16:54
Best DH command display for batches reports.
df -hPT
@mhou1981
mhou1981 / robocopy_example.bat
Created July 26, 2019 16:17
Windows ROBOCOPY command example
ECHO OFF
robocopy "SOURCE_DIR" "DEST_DIR" /MIR
@mhou1981
mhou1981 / egrep_ip4.sh
Created June 13, 2019 16:15
Egrep Regex for IPv4
egrep "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"
@mhou1981
mhou1981 / bash_no_rc_no_profile.sh
Last active June 12, 2019 00:03
Shell prompt without loading rc nor profile
ssh -t user@host bash --norc --noprofile
# or
bash --norc --noprofile
@mhou1981
mhou1981 / IPv4_matching_regex
Created January 2, 2019 07:05
IPv4_matching_regex
^(2[0-4][0-9]|25[0-5]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.(2[0-4][0-9]|25[0-5]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.(2[0-4][0-9]|25[0-5]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.(2[0-4][0-9]|25[0-5]|1[0-9][0-9]|[1-9][0-9]|[0-9])$
@mhou1981
mhou1981 / Build Piaware on Ubuntu 18.04 LTS x86
Created December 23, 2018 07:11
Build Piaware on Ubuntu 18.04 LTS x86
# run as root
apt install build-essential debhelper tcl8.6-dev autoconf python3-dev python3-venv dh-systemd libz-dev
git clone https://github.com/flightaware/piaware_builder.git
./sensible-build.sh bionic
cd package-bionic/
dpkg-buildpackage -uc -us -b
cd ../
apt install piaware_*.deb