Skip to content

Instantly share code, notes, and snippets.

View allaniftrue's full-sized avatar

Tux allaniftrue

  • 12:43 (UTC +08:00)
View GitHub Profile
@allaniftrue
allaniftrue / PinEncryption.php
Created January 5, 2017 03:41
Encrypting a password with a self-signed certificate
<?php
/**
*
* @param $password A user defined password
* @return string
*
*/
public function encryptPasswordToRsaBase64(string $password): string
{
$publicKey = fopen('/path/to/public/key.pem', 'r');
...
<tr>
<td bgcolor="#E9E9E9" class="emailcolsplit">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td style="padding-left:20px; padding-bottom:20px;">
<h2>He revels in disorganization.</h2>
<p>But you don’t have time for confusion. The IBM Journey Designer can help you refine the buyer journey across channels to create exceptional customer experiences.</p>
<img src="images/learn_01.jpg" width="115" height="34" alt=""/>
</td>
@allaniftrue
allaniftrue / phpci.yml
Created September 9, 2016 09:54 — forked from skecskes/phpci.yml
phpci.yml Laravel 5 config
build_settings:
verbose: false
prefer_symlink: false
setup:
composer:
action: "install"
prefer_dist: false
test:
@allaniftrue
allaniftrue / facebook_ads_preferences.js
Created August 31, 2016 15:03
Automate removal of facebook ads preferences. Let document load > click load more until all interests are loaded > open developer tools > paste code
var rmBtns = document.querySelectorAll('[aria-label="Remove"]')
rmBtns.forEach(function(el) {
el.click();
});
@allaniftrue
allaniftrue / sarg.conf
Created February 21, 2016 09:44
custom Sarg Configuration
# sarg.conf
#
# TAG: access_log file
# Where is the access.log
# sarg -l file
#
access_log /250Vault/squid/logs/access.log
# TAG: graphs yes|no
# Use graphics where possible.
@allaniftrue
allaniftrue / ipfw.rules
Last active February 25, 2023 22:42
/etc/ipfw.rules
#!/bin/sh
# Flush out the list before we begin.
ipfw -q -f flush
# Set rules command prefix
cmd="ipfw -q add"
pif="vtnet0" # interface name of NIC attached to Internet
$cmd 00005 allow all from any to any via vtnet0
@allaniftrue
allaniftrue / easylist_adservers.php
Created October 18, 2015 10:29
Extract Easylist Adservers from the huge file for DNS
<?php
# Get contents from easylist domain
$content = file_get_contents('easylist.txt');
# Extract adserver list only
preg_match('/(\!\s\*\*\*\seasylist:easylist\/easylist_adservers\.txt\s\*\*\*)[^"]+(\!\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-Third\-party\sadverts\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\!)/', $content, $extracted, PREG_OFFSET_CAPTURE);
/*
* Remove unnecessary strings from every URL
@allaniftrue
allaniftrue / recursive_check
Created September 28, 2015 03:30
WIndows command to do recursive loop.
#Needs imagemagick library
D:\>for /R %i in (*.jpg) DO identify %i >> result.txt
@allaniftrue
allaniftrue / hombrew_summary
Created June 22, 2015 14:03
Homebrew php56 Message After Install
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
The php.ini file can be found in:
/usr/local/etc/php/5.6/php.ini
✩✩✩✩ PEAR ✩✩✩✩
If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
chmod -R ug+w /usr/local/Cellar/php56/5.6.10/lib/php
<?php namespace App\Http\Middleware;
use Closure;
class AfterMiddleware{
/**
* Handle an outgoing request.
*
* @param \Illuminate\Http\Request $request