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
@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 April 12, 2024 16:43
fail2ban WordPress Nginx

Restart service

sudo service fail2ban restart

Look at logs

tail -f /var/log/fail2ban.log
@pamolloy
pamolloy / README.md
Last active January 23, 2024 07:28
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 26, 2024 21:35
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 15, 2024 00:53
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
#!/usr/bin/env python
import i3
outputs = i3.get_outputs()
workspaces = i3.get_workspaces()
# figure out what is on, and what is currently on your screen.
workspace = list(filter(lambda s: s['focused']==True, workspaces))
output = list(filter(lambda s: s['active']==True, outputs))
@stefansundin
stefansundin / extract-attachments.py
Last active September 27, 2022 18:54
Extract attachments from emails that Gmail doesn't allow you to download. This is dumb. Please use Python >= 3.4.
#!/usr/bin/env python3
# Get your files that Gmail block. Warning message:
# "Anti-virus warning - 1 attachment contains a virus or blocked file. Downloading this attachment is disabled."
# Based on: https://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/
# Instructions:
# Go to your emails, click the arrow button in the top right, "Show original", then "Download Original".
# Move the files to the same directory as this program, then run it.
import sys