Skip to content

Instantly share code, notes, and snippets.

## Per https://support.acquia.com/hc/en-us/articles/360042181273-Block-Access-to-Bad-Bots-coming-from-the-Huawei-Cloud
## this should be immediately after the RewriteEngine On line in your .htaccess file
################## Begin User Agent Blocks ########################
#RewriteCond %{HTTP_USER_AGENT} ^(.*)(.*)$
#Block empty user agents, these are never any good.
RewriteCond %{HTTP_USER_AGENT} ^-?$
RewriteRule .* - [R=410,L]
@defulmere
defulmere / gist:438b3cf94cc725c6a67e40888e1e280a
Last active November 19, 2024 21:30
colored bar graph of system load over time in terminal with atopsar
np=$( nproc ); atopsar -p | grep ":[0-9]\{2\}\s\+[0-9]" | awk '{printf("\n%s %6.2f ",$1, $5); for (i = 0; i<$5; i++) {if (i<'$np'*.7) {printf "\033[32m"} else if (i<'$np') {printf "\033[33m"} else {printf "\033[31m"}; printf("█")}; printf "\033[0m"}'; echo ""
@wazum
wazum / aspect_ratio.php
Last active January 13, 2025 17:10
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);
@fhferreira
fhferreira / nginx-proxy.conf
Created August 16, 2019 02:52
Proxy nginx to use Google Tag Manager
# Google Analytics Bypassing Adblockers
## Client
change www.googletagmanager.com => your.domain.com
```
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://your.domain.com/gtag/js?id=UA-123456789-1"></script>
```
@talkingnews
talkingnews / ffmpeg_build.sh
Last active August 21, 2024 17:52 — forked from iJackUA/ffmpeg_build.sh
Build ffmpeg and all needed codecs from latest git revisions
#!/bin/bash
sudo apt-get update -qq && sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
@Subtixx
Subtixx / steamworkshop.php
Last active March 21, 2022 22:49
Steam Workshop downloader
<?php
/*
* Usage Multiples:
* http://localhost/steamworkshop.php?ids[]=779297608&ids[]=468207596&ids[]=568872931&ids[]=898613611
* Usage Single:
* http://localhost/steamworkshop.php?id=779297608
*/
set_time_limit(0);
define("API_URL", "http://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v0001/");
@nonwip
nonwip / ffmpeg.md
Last active May 22, 2025 00:17
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
@jeffersfp
jeffersfp / fix.sh
Created September 14, 2016 19:14 — forked from icsaas/fix.sh
dpkg: warning: files list file for package `*****' missing, assuming package has no files currently installed
#!/bin/bash
set -e
# Clean out /var/cache/apt/archives
apt-get clean
# Fill it with all the .debs we need
apt-get --reinstall -dy install $(dpkg --get-selections | grep '[[:space:]]install' | cut -f1)
DIR=$(mktemp -d -t info-XXXXXX)
for deb in /var/cache/apt/archives/*.deb
@lopspower
lopspower / README.md
Last active October 11, 2025 11:06
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@Rodrigo54
Rodrigo54 / php-html-css-js-minifier.php
Last active June 29, 2025 14:27 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {