Skip to content

Instantly share code, notes, and snippets.

View yolabingo's full-sized avatar

Todd Jacobsen yolabingo

  • New Mexico, USA
View GitHub Profile
from __future__ import with_statement # we'll use this later, has to be here
from argparse import ArgumentParser
import requests
from BeautifulSoup import BeautifulStoneSoup as Soup
def parse_sitemap(url):
resp = requests.get(url)
# we didn't get a valid response, bail
#!/bin/bash
scriptname=$(basename "$0")
for index in $(pacmd list-sink-inputs | egrep -i -B 25 "seamonkey|chrome|firefox" | grep index: | awk '{print $2}')
do
volume=$(pacmd list-sink-inputs | grep -A 8 "index: ${index}" | grep volume: | awk '{print $3}')
if [ $scriptname == "volume-up" ]
then
echo "volume up"
@yolabingo
yolabingo / gist:c26dd4cc70518418eff9c80213882a6f
Created December 7, 2017 22:51
apache ErrorLog to syslog-ng snippet
filter f_apache_error { match('^apache2' value("MSGHDR")) };
filter f_apache_error_send_email {
(message('Option') and message('not allowed here'))
};
filter f_apache_php_notice {
message('PHP Notice') or
message('PHP Deprecated') or
message('PHP Strict Standards')
@yolabingo
yolabingo / gist:b422d3c33357518431abb3e3b82adf43
Last active December 9, 2017 07:51
gentoo make.conf for non-binhost apache server
CFLAGS="-march=core2 -O2 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="x86_64-pc-linux-gnu"
USE="mmx sse sse2 apache2 -gtk -gnome -kde -alsa -cups -X"
MAKEOPTS="-j2"
GENTOO_MIRRORS="ftp://ftp.gtlib.gatech.edu/pub/gentoo http://gentoo.osuosl.org/"
PORTAGE_ELOG_MAILURI="noc@redacted.com"
PORTAGE_ELOG_MAILFROM="noc@redacted.com"
PORTAGE_BINHOST="http://gentoo-binhost.redacted.com/"
EMERGE_DEFAULT_OPTS="--autounmask=y --getbinpkg"
@yolabingo
yolabingo / preseed.cfg
Created April 3, 2018 19:25
Debian preseed.cfg example
=========== preseed.cfg ==========
#### IMPORTANT NOTE - replace "strongpassword" with an actual strong
password.
## autostart SSH install
d-i debian-installer/country string AU
d-i debian-installer/locale string en_AU.UTF-8
d-i debian-installer/language string en_AU:en
### Network configuration
# d-i netcfg/disable_dhcp boolean true
@yolabingo
yolabingo / mysql-dump-chunks.py
Last active May 6, 2019 22:30
create multiple MySQL dump files for a single (presumably large) table
#!/usr/bin/env python3
import sys
# create mysqldump commands to create multiple sql files for a single (large) table
# specify dump_file_count for desired number of files
db_host = 'HOST'
db_user = 'USER'
db_name = 'DBNAME'
db_pass = 'PASS'
https://github.com/ewwhite/zfs-ha/wiki
http://zfswatcher.damicon.fi/
https://serverfault.com/questions/842531/how-to-perform-incremental-continuous-backups-of-zfs-pool
http://wiki.lustre.org/Optimizing_Performance_of_SSDs_and_Advanced_Format_Drives
http://www.bolthole.com/solaris/zrep/zrep.documentation.html
@yolabingo
yolabingo / fail2ban-unban-ip.sh
Last active May 6, 2020 13:16
shell script to remove IPv4 addresses from all fail2ban jails
#!/usr/bin/env bash
function print_help {
echo "remove an ip address from all fail2ban jails"
echo "$(basename $0) ip_address [ip_address] [ip_address]"
}
if [[ -z "$@" ]]
then
print_help
fi
@yolabingo
yolabingo / wp-email-validate-check.php
Last active May 21, 2020 04:15
Test Wordpress email validation regular expression
<?php
/*
Wordpress bug https://core.trac.wordpress.org/ticket/47855
When using a current PHP version, class-phpmailer.php:validateAddress() uses a complex regex ("pcre8") for email address validation.
PHP < 7.3 uses libpcre 8.x.
PHP 7.3 uses libpcre2 10.x.
Due to a bug in libpcre2 < 10.32-RC1 https://bugs.exim.org/show_bug.cgi?id=2300,
@yolabingo
yolabingo / fail2ban-purge-db.sh
Last active July 3, 2020 18:53
purge old fail2ban bans from sqlite db
#!/bin/bash
# prune sqlite db file for fail2ban v 0.9.x
# run me from cron to keep sqlite db a sane size
# fail2ban doesn't purge old entries from sqlite db, so it grows until things break
# https://gist.github.com/yolabingo/ef4a41853b46503bb2e6537d1129fb46
dbfile=$(fail2ban-client get dbfile | grep "\`-" | awk '{print $2}')
dbpurgeage=$(fail2ban-client get dbpurgeage | grep "\`-" | awk '{print $2}' | sed 's/seconds.*//')