Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am hmngwy on github.
  • I am patambrosio (https://keybase.io/patambrosio) on keybase.
  • I have a public key ASCgb23a1pULQ4RYeNJJi0WWRhlrd-h7gIGDdncJUGOn_Qo

To claim this, I am signing this object:

@hmngwy
hmngwy / install-all-firehol.sh
Created March 12, 2019 15:37
Install the whole firehol suite
#!/bin/bash
# from https://github.com/firehol/firehol/wiki/Install-the-whole-firehol-suite
LC_ALL=C
# 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
hmngwy / wp_backup.sh
Last active July 20, 2017 08:02
Backs Up Wordpress Folder and DB in one go
function wpbackup {
folder=$1
name=$1
dest="."
if [ ! -z $2 ]; then
dest=$2
fi
if [ ! -z $3 ]; then
name=$3
fi
@hmngwy
hmngwy / load.sh
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
# SURFMAX 50
curl 'http://smart.com.ph/BroDashBoard/prepaid/availment/register' -H 'Accept: */*' -H 'Referer: http://smart.com.ph/brodashboard/prepaid/availment' -H 'Origin: http://smart.com.ph' -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
# SURFMAX 85
curl 'http://smart.com.ph/BroDashBoard/prepaid/availment/register' -H 'Accept: */*' -H 'Referer: http://smart.com.ph/brodashboard/prepaid/availment' -H 'Origin: http://smart.com.ph' -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.

Usage

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
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
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
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 (.*)_(.*) http://www.example.com/$1-$2 [L,R=301]
RewriteCond %{REQUEST_URI} ^(.*)-(.*)$
RewriteRule (.*)-(.*) /$1_$2?r=1 [L]
#!/bin/sh
#
# init script for a Java application
#
# Check the application status
#
# This function checks if the application is running
check_status() {
@hmngwy
hmngwy / .htaccess
Last active December 3, 2015 16:56
Htaccess Base Directives, Pagespeed Leverage Browser Caching, Enable Compression
## EXPIRES CACHING ##
<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"