Skip to content

Instantly share code, notes, and snippets.

View newactual's full-sized avatar

Frank K-a newactual

  • Gold Coast
  • 09:00 (UTC)
View GitHub Profile
@newactual
newactual / gist:45140e294453f3f91138156542bd8607
Created February 2, 2023 00:39 — forked from dvlop/gist:fca36213ad6237891609e1e038a3bbc1
My long list of bad bots to block in htaccess, ready to copy and paste!
# Start Bad Bot Prevention
<IfModule mod_setenvif.c>
# SetEnvIfNoCase User-Agent ^$ bad_bot
SetEnvIfNoCase User-Agent "^12soso.*" bad_bot
SetEnvIfNoCase User-Agent "^192.comAgent.*" bad_bot
SetEnvIfNoCase User-Agent "^1Noonbot.*" bad_bot
SetEnvIfNoCase User-Agent "^1on1searchBot.*" bad_bot
SetEnvIfNoCase User-Agent "^3D_SEARCH.*" bad_bot
SetEnvIfNoCase User-Agent "^3DE_SEARCH2.*" bad_bot
SetEnvIfNoCase User-Agent "^3GSE.*" bad_bot
@newactual
newactual / aspect_ratio.php
Created January 10, 2023 11:19 — forked from wazum/aspect_ratio.php
PHP Calculate aspect ratio from width and height
<?php
function getAspectRatio(int $width, int $height)
{
// search for greatest common divisor
$greatestCommonDivisor = static function($width, $height) use (&$greatestCommonDivisor) {
return ($width % $height) ? $greatestCommonDivisor($height, $width % $height) : $height;
};
$divisor = $greatestCommonDivisor($width, $height);