Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am hmngwy on github.
  • I am patambrosio ( on keybase.
  • I have a public key ASCgb23a1pULQ4RYeNJJi0WWRhlrd-h7gIGDdncJUGOn_Qo

To claim this, I am signing this object:

hmngwy /
Created March 12, 2019 15:37
Install the whole firehol suite
# from
# you need to install a basic build environment
# this is for ubuntu, change it according to your needs for other systems
# apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autogen automake pkg-config traceroute ipset curl nodejs zip unzip jq ulogd autoconf-archive firehol || exit 1
for x in iprange firehol netdata
hmngwy /
Last active July 20, 2017 08:02
Backs Up Wordpress Folder and DB in one go
function wpbackup {
if [ ! -z $2 ]; then
if [ ! -z $3 ]; then
hmngwy /
Last active December 4, 2015 04:18
Purchasing a data package from Smart Telecom without having to open their god damned dashboard that barely works
# May or may not work depending on smart updating the website, use at your own risk - you only have yourself to blame
# Make sure you are not using a custom DNS(s) on your network configuration, so that smart doesn't filter you out
curl '' -H 'Accept: */*' -H 'Referer:' -H 'Origin:' -H 'X-Requested-With: XMLHttpRequest' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36' -H 'Content-Type: application/json; charset=UTF-8' --data-binary '{"promoId":2743,"brand":"BROPREPAID"}' --compressed
curl '' -H 'Accept: */*' -H 'Referer:' -H 'Origin:' -H 'X-Requested-With: XMLHttpRequest' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) Appl

Regular Expressions for Google Analytics filters as of July 24, 2015

Based on the list at OHow and some from Ben Travis.

I would've used the 3 expressions at Travis' post but I don't have the time to check what they cover exactly, so I just carpet bombed it using the list from OHow.

It's split into 4 because of the 255 character limit.


If you're not sure how to use this follow the first or second link above, in the second link Ben makes a thorough explanation how to use this to filter both historical and incoming data, in the first link OHow goes through how you can make or update these expressions.

hmngwy / .htaccess_force_trailing_slashes
Created May 19, 2015 07:50
Force trailing slashes in Apache
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ - [env=proto:https]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ - [env=proto:http]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpg|png|jpeg|css|js)$ [NC]
RewriteRule ^(.*)$ %{ENV:proto}://%{HTTP_HOST}/$1/ [L,R=301]
hmngwy / .htaccess
Created February 20, 2015 08:07
Apache Canonical Redirect for any Domain #rewriteengine #htaccess #mod_rewrite
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
hmngwy / dashes
Last active August 29, 2015 14:05
mod_rewrite directives for underscore-separated-paths into dashes, in .htaccess, without any site file changes
RewriteEngine On
RewriteCond %{QUERY_STRING} !(.*)r=1(.*)
RewriteCond %{REQUEST_URI} ^(.*)html$
RewriteCond %{REQUEST_URI} ^(.*)_(.*)$
RewriteRule (.*)_(.*)$1-$2 [L,R=301]
RewriteCond %{REQUEST_URI} ^(.*)-(.*)$
RewriteRule (.*)-(.*) /$1_$2?r=1 [L]
# init script for a Java application
# Check the application status
# This function checks if the application is running
check_status() {
hmngwy / .htaccess
Last active December 3, 2015 16:56
Htaccess Base Directives, Pagespeed Leverage Browser Caching, Enable Compression
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"