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 May 14, 2025 08:03
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 June 12, 2025 07:41
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

@thewh1teagle
thewh1teagle / silent_boot.sh
Created June 8, 2020 08:53
Silent boot Debian 10
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
echo 'GRUB_DEFAULT=0' > /etc/default/grub
echo 'GRUB_TIMEOUT=5' >> /etc/default/grub
echo 'GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`' >> /etc/default/grub
echo 'GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 vga=current rd.systemd.show_status=auto rd.udev.log-priority=3 vt.global_cursor_default=0"' >> /etc/default/grub
echo 'GRUB_CMDLINE_LINUX="console=ttyS0"' >> /etc/default/grub
@benfavre
benfavre / README.MD
Last active June 10, 2025 03:39
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 April 22, 2025 05:25
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