Skip to content

Instantly share code, notes, and snippets.

View allaniftrue's full-sized avatar

Tux allaniftrue

  • 13:18 (UTC +08:00)
View GitHub Profile
@allaniftrue
allaniftrue / smsdCrontScript
Created January 18, 2015 15:15
A shell script to run sums on startup with cronjob
#!/bin/bash
#Script used to run gnokii smsd
#Cronjob @solidmarkup.com
/usr/sbin/smsd -u root -p MySQLPassword -d smsgw -c localhost -m mysql -b IN -f /var/log/smsdaemon.log
@allaniftrue
allaniftrue / gist:c2e1fe2092543b3a5c4c
Created February 8, 2015 08:25
Network Latency Graph
#Console 1
ping -i .2 <GATEWAY MAC ADDRESS> | egrep --line-buffered -v 'PING|timeout' | sed -l -e 's/^.* time=\(.*\) ms$/\1/g' > ping.bat
#Console 2
while true ; do tail -n 150 ping.bat | gnuplot -e "set term dumb size 150, 40; plot '-'" ; sleep 1 ; done
@allaniftrue
allaniftrue / stickyMenu.html
Created February 23, 2015 10:29
A jQuery approach on sticky menu
<!DOCTYPE html>
<html lang="">
<head>
<title>Title Page</title>
<meta charset="UTF-8">
<meta name=description content="">
<meta name=viewport content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.min.css">
<style>
@allaniftrue
allaniftrue / app.js
Created March 17, 2015 06:52
All jQuery sticky menu
$(document).ready(function(){
var $nav = $('.navigation'),
$mhlHeight = $('.mhl').height(),
fixedStyle = {
'position':'fixed',
'top':0,
'left':0,
'z-index':1,
'width':'100%'
<?php namespace App\Http\Middleware;
use Closure;
class AfterMiddleware{
/**
* Handle an outgoing request.
*
* @param \Illuminate\Http\Request $request
@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
@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 / 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 / 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 / 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.