Skip to content

Instantly share code, notes, and snippets.

@WebDragon
WebDragon / .htaccess
Created November 15, 2023 00:45
force https but allow validation from LetsEncrypt among others
# Force HTTPS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
@WebDragon
WebDragon / formsample.html
Last active September 20, 2023 15:59
Javascript and css to take required and placeholder-shown fields and mark them with warning colors automatically, and clear the marks after they are valid fields
<form action="" enctype="multipart/form-data" method="post">
<p>
<label for="name">Name: </label>
<input id="name" name="name" required="" size="65" type="text" />
</p>
<p>
<label for="jobtitle">Job Title:</label>
<input id="jobtitle" name="jobtitle" required="" size="65" type="text" />
</p>
<p>
@WebDragon
WebDragon / iptrack.pl
Last active February 29, 2024 19:56
inspect /var/log/secure and look for attempts on root, N days ago, and report if an IP attempted access more than X times, and additionally check for an entry in /etc/csf/csf.deny
#!/usr/bin/perl
use warnings;
use v5.16;
use Sort::Key::IPv4 qw(ipv4sort);
my (%ipcounts, $monthdate);
my ($min, $daysago, $verbose, $help, $usage) = ( 8 , 1 );
use Getopt::Long;
use Pod::Usage;
#!/usr/bin/perl
## Author: Scott R. Godin - MAD House Graphics
## Created: Wed Nov 9 12:42:52 EST 2022
## Last Updated: Fri, Nov 11, 2022 11:32:04 AM
use warnings;
use strict;
use Getopt::Long;
use Pod::Usage;
use Regexp::Common qw/ number /;
use POSIX qw/ ceil /;
@WebDragon
WebDragon / latest.log
Created November 12, 2021 06:08
latest.log with minecolonies AI exception for gravedigger, from minecolonies-1.0.118-ALPHA-universal
[12Nov2021 01:00:52.741] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, WebDragonG3, --version, 1.16.5-forge-36.2.2, --gameDir, C:\Users\macte\AppData\Local\.ftba\instances\9ee2def6-6bd9-448f-9ce5-906fbdf17fc8, --assetsDir, C:\Users\macte\AppData\Local\.ftba\bin\assets, --assetIndex, 1.16, --uuid, bbaca6f71b4e47ef982cee3e559736a8, --accessToken, ????????, --userType, mojang, --versionType, release, --width, 1680, --height, 1050, --launchTarget, fmlclient, --fml.forgeVersion, 36.2.2, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20210115.111550]
[12Nov2021 01:00:52.747] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 1.8.0_51 by Oracle Corporation
[12Nov2021 01:00:52.770] [main/WARN] [cpw.mods.modlauncher.SecureJarHandler/]: LEGACY JDK DETECTED, SECURED JAR HANDLING DISABLED
[12Nov2021 01:00:53.419] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Adde
@WebDragon
WebDragon / latest.log
Created November 9, 2021 19:42
latest.log with minecolonies AI exception for gravedigger
[09Nov2021 14:09:52.890] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, WebDragonG3, --version, 1.16.5-forge-36.2.2, --gameDir, C:\Users\macte\AppData\Local\.ftba\instances\9ee2def6-6bd9-448f-9ce5-906fbdf17fc8, --assetsDir, C:\Users\macte\AppData\Local\.ftba\bin\assets, --assetIndex, 1.16, --uuid, bbaca6f71b4e47ef982cee3e559736a8, --accessToken, ????????, --userType, mojang, --versionType, release, --width, 1680, --height, 1050, --launchTarget, fmlclient, --fml.forgeVersion, 36.2.2, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20210115.111550]
[09Nov2021 14:09:52.893] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 1.8.0_51 by Oracle Corporation
[09Nov2021 14:09:52.908] [main/WARN] [cpw.mods.modlauncher.SecureJarHandler/]: LEGACY JDK DETECTED, SECURED JAR HANDLING DISABLED
[09Nov2021 14:09:53.460] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Adde
@WebDragon
WebDragon / ang
Created January 7, 2021 18:36
launcher script for Angband (rephial.org) for Linux, to set up environment to enable multi-windowed gaming
#!/bin/tcsh
# place in ~/bin/ang
echo "Launching angband..."
sleep 2
# Main window
setenv ANGBAND_X11_FONT_0 8x13
setenv ANGBAND_X11_AT_X_0 5
setenv ANGBAND_X11_AT_Y_0 22
@WebDragon
WebDragon / track-custom-parent.pl
Created August 30, 2019 18:10
custom perl code to track differences in CiviCRM template overrides vs their originating counterparts in revision control (both git and the previous svn repositories)
#!/usr/bin/perl
use warnings;
use strict;
use v5.28;
### Customizations
#
my $custom_path = "/home/webdragon/Downloads/hccpa/_files/customization";
my $allversions = "$custom_path/git-export-all-versions";
my $storfile = "$custom_path/_tracking.stor";
@WebDragon
WebDragon / wp-db.php.patch
Last active December 20, 2015 03:49
patch wp-includes/wp-db.php on a mysql server that is set up to normally run as SQL_MODE="ANSI,TRADITIONAL,ONLY_FULL_GROUP_BY" -- which wordpress currently barfs all over because it has not yet been reconfigured to run on a strict server, so that this way, wordpress will function as it normally would on a default mysql server with no strictness …
--- wp-includes/wp-db.php 2013-06-21 14:41:52.000000000 -0400
+++ wp-includes/wp-db.php 2013-07-23 18:37:01.298896949 -0400
@@ -1166,6 +1166,7 @@
$this->ready = true;
$this->select( $this->dbname, $this->dbh );
+ mysql_query( "SET sql_mode=''", $this->dbh);
}
/**
@WebDragon
WebDragon / my.cnf
Last active December 18, 2015 04:10
Saner Default settings for mysql config without which the universe generally is far more insane than it should be and data can be silently truncated at insert time with no warning whatsoever. Why mysql is not set to have these stricter settings by default is beyond me.
# NOTE also for mysql db driver connections like PDO, try and ensure the following
## init_connect = 'SET collation_connection = utf8_unicode_ci'
## init_connect = 'SET NAMES utf8'
## SET character_set_results=utf8;
## SET character_set_client=utf8;
## SET character_set_connection=utf8;
#~~~~~~
[mysqld]