Skip to content

Instantly share code, notes, and snippets.

View haydenjames's full-sized avatar
馃彔
Working from home

Hayden James haydenjames

馃彔
Working from home
View GitHub Profile
@haydenjames
haydenjames / auto-profile-update.sh
Last active January 20, 2025 05:22 — forked from vwbusguy/auto_profile
Auto Update for power-profiles-daemon
#!/bin/bash
# Initialize the last known state to prevent redundant actions
LAST_LEVEL=""
dbus-monitor --system "type='signal',path='/org/freedesktop/UPower/devices/battery_BAT0',member='PropertiesChanged'" | while read LINE; do
echo ${LINE} | grep battery_BAT0 | grep -q PropertiesChanged
if [ $? -eq 0 ]; then
BATT_STAT=$(dbus-send --print-reply=literal --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/devices/battery_BAT0 org.freedesktop.DBus.Properties.Get string:org.freedesktop.UPower.Device string:State | awk '{ print $3; }')
@vwbusguy
vwbusguy / auto_profile
Last active August 7, 2026 11:07
Auto Update for power-profiles-daemon
#!/bin/bash
dbus-monitor --system "type='signal',path='/org/freedesktop/UPower/devices/battery_BAT0',member='PropertiesChanged'" | while read LINE; do
echo ${LINE} | grep battery_BAT0 | grep -q PropertiesChanged
if [ $? -eq 0 ]; then
BATT_STAT=$(dbus-send --print-reply=literal --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/devices/battery_BAT0 org.freedesktop.DBus.Properties.Get string:org.freedesktop.UPower.Device string:State | awk '{ print $3; }')
if [ $BATT_STAT -eq 1 ] || [ $BATT_STAT -eq 4 ]; then
LEVEL=$(tuned-adm list | grep -q throughput-performance && echo "throughput-performance" || echo "balanced")
elif [ $BATT_STAT -eq 5 ]; then
LEVEL="balanced"
@bluewalk
bluewalk / GetNordVPNWireGuardDetails.md
Last active September 17, 2026 13:51
Getting NordVPN WireGuard details

About

Instructions to obtain WireGuard details of your NordVPN account. These can be used to setup a WireGuard tunnel on your router to NordVPN.

Source: https://forum.gl-inet.com/t/configure-wireguard-client-to-connect-to-nordvpn-servers/10422/27

Prerequisites

If you have any linux machine, use that or install a vm if you don't have one.

Get their official linux app installed. Make sure you have wireguard installed too. And set the used technology to Nordlynx by running nordvpn set technology nordlynx

@benfavre
benfavre / README.MD
Last active October 15, 2025 19:54
fail2ban WordPress Nginx

Restart service

sudo service fail2ban restart

Look at logs

tail -f /var/log/fail2ban.log
@pamolloy
pamolloy / README.md
Last active October 16, 2024 20:40
Ubiquiti USG configuration for Wireguard

Download the latest ugw3 package from https://github.com/Lochnair/vyatta-wireguard/releases and install it on your USG using dpkg -i wireguard-ugw3-<version>.deb.

cd /config/auth
umask 077
mkdir wireguard
cd wireguard
wg genkey > wg_private.key
wg pubkey < wg_private.key > wg_public.key
@coldfire84
coldfire84 / default.conf
Last active March 10, 2023 03:33
Nginx Config
# Hardening as-per https://gist.github.com/plentz/6737338
server_tokens off;
# Expires map
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
function child_theme_dequeue_style()
{
wp_dequeue_style('wpsisac_slick_style');
wp_dequeue_style('wpos-slick-style');
wp_dequeue_style('menu-icons-extra');
wp_dequeue_style('woocommerce_frontend_styles');
wp_dequeue_style('woocommerce-general');
wp_dequeue_style('woocommerce-layout');
wp_dequeue_style('woocommerce-smallscreen');
wp_dequeue_style('woocommerce_fancybox_styles');
@bsodmike
bsodmike / edgerouter-VPN-config.txt
Created August 13, 2017 10:29
EdgeRouter OpenVPN to Private Internet Access!
# Reference: https://www.youtube.com/watch?v=B9dXiKhDVl0
## Remember to tailor this to your network! ##
set interfaces openvpn vtun0 config-file /config/auth/midwest.ovpn
set interfaces openvpn vtun0 description 'Private Internet Access'
set interfaces openvpn vtun0 enable
set service nat rule 5000 description PIA
set service nat rule 5000 log disable
set service nat rule 5000 outbound-interface vtun0
@gr1ev0us
gr1ev0us / find.sh
Last active March 30, 2026 07:21
Cheatsheet for find linux
# List of cheatsheet for linux find.
# Taken from here http://alvinalexander.com/unix/edu/examples/find.shtml
# basic 'find file' commands
# --------------------------
find / -name foo.txt -type f -print # full command
find / -name foo.txt -type f # -print isn't necessary
find / -name foo.txt # don't have to specify "type==file"
find . -name foo.txt # search under the current dir
find . -name "foo.*" # wildcard
@umpirsky
umpirsky / ubuntu-raid.sh
Last active April 28, 2025 11:03
Install Ubuntu on RAID 0 and UEFI/GPT system
# http://askubuntu.com/questions/505446/how-to-install-ubuntu-14-04-with-raid-1-using-desktop-installer
# http://askubuntu.com/questions/660023/how-to-install-ubuntu-14-04-64-bit-with-a-dual-boot-raid-1-partition-on-an-uefi%5D
sudo -s
apt-get -y install mdadm
apt-get -y install grub-efi-amd64
sgdisk -z /dev/sda
sgdisk -z /dev/sdb
sgdisk -n 1:0:+100M -t 1:ef00 -c 1:"EFI System" /dev/sda
sgdisk -n 2:0:+8G -t 2:fd00 -c 2:"Linux RAID" /dev/sda