Skip to content

Instantly share code, notes, and snippets.


Marcus Bointon Synchro

View GitHub Profile
View gist:1220517c548bbbb1a2d5
### Keybase proof
I hereby claim:
* I am Synchro on github.
* I am synchro ( on keybase.
* I have a public key whose fingerprint is EC46 91BE 3D1E 19D7 DE28 E55F DE31 CD6E B646 AA24
To claim this, I am signing this object:
View gist:f2e4d63b7ca5b92bee1c
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
Synchro / gist:42288e72af89fb7d0c1e
Created Sep 29, 2014
Homebrew php 5.6 failing to run
View gist:42288e72af89fb7d0c1e
brew rm php56 && brew deps php56 | xargs brew rm
Uninstalling /usr/local/Cellar/php56/5.6.0...
Uninstalling /usr/local/Cellar/freetype/2.5.3_1...
Uninstalling /usr/local/Cellar/gettext/0.19.2...
Uninstalling /usr/local/Cellar/zlib/1.2.8...
Uninstalling /usr/local/Cellar/icu4c/53.1...
Uninstalling /usr/local/Cellar/jpeg/8d...
Uninstalling /usr/local/Cellar/libpng/1.6.13...
Uninstalling /usr/local/Cellar/libtool/2.4.2...
Uninstalling /usr/local/Cellar/unixodbc/2.3.2...
Synchro / lockmonitor.php
Last active Dec 19, 2015
Simple PHP MySQL slow query (i.e. most likely stuck waiting for a lock) monitor.
View lockmonitor.php
#!/usr/bin/env php
$mysqli = new mysqli('localhost', 'user', 'pass');
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
$out = false;
$output = array();
Synchro / gist:5917252
Last active Mar 18, 2016
Logstash config for parsing drupal watchdog log entries. Greps the syslog_program source first to check it's logged by drupal, then takes apart the watchdog log pattern. See:!syslog!syslog.module/function/syslog_watchdog/7
View gist:5917252
grep {
type => "syslog"
match => [ "syslog_program", "drupal" ]
add_tag => "Drupal"
drop => false
grok {
type => "syslog"
tags => [ "Drupal" ]
match => [ "@message", "^https?://%{HOSTNAME:drupal_vhost}\|%{NUMBER:drupal_timestamp}\|(?<drupal_action>[^\|]*)\|%{IP:drupal_ip}\|(?<drupal_request_uri>[^\|]*)\|(?<drupal_referer>[^\|]*)\|(?<drupal_uid>[^\|]*)\|(?<drupal_link>[^\|]*)\|(?<drupal_message>.*)" ]
Synchro / Generic logstash init script
Last active Dec 19, 2015 — forked from jippi/rc.d
Rather than copying and editing an `init.d` file simply to point it at a different config file, you can have it work it out from the filename, so you can use the same init file for all your logstash agents. The filename must follow the established convention for logstash and it splits on the dash in the name, so names like `logstash-indexer`, `l…
View Generic logstash init script
#! /bin/sh
# Provides: logstash-shipper
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
Synchro / gist:3749394
Created Sep 19, 2012
PHP script to report and/or extract sections from apache and icecast log files by date ranges
View gist:3749394
#!/usr/bin/env php
* Extract a section of an apache or icecast log file between two dates
* Assumes that log lines are in chronological order
* Start and end dates can be in any format that strtotime can handle
* Reads from stdin, outputs to stdout, stats to stderr
* @author Marcus Bointon <>
* @link
* Example usage. Report the range of dates in a log file
Synchro / index.php
Created Nov 21, 2011
FatFree config for files outside web root
View index.php
Folder structure:
/lib (fatfree files in here)
/ui (view templates)
/web (Doc root, static files and index.php)
If you're not using a .htaccess file, I found the default rewrites don't work in a vhost, had to change it to this:
Synchro / Premailer.php
Created Sep 8, 2011
PHP interface class for the Premailer API
View Premailer.php
* Premailer API PHP class
* Premailer is a library/service for making HTML more palatable for various inept email clients, in particular GMail
* Primary function is to convert style tags into equivalent inline styles so styling can survive <head> tag removal
* Premailer is owned by Dialect Communications group
* @link
* @author Marcus Bointon <>
Synchro / gist:1139429
Created Aug 11, 2011
PHP Base-62 encoder/decoder
View gist:1139429
* This is an example of a practical encoder and decoder for base-62 data in PHP
* It differs from the majority of examples in that it's fast enough for moderate data sizes, unlike multiprecision converters
* To be practical, base-62 encoding needs to use internal chunking and padding because base-62 does not fit exactly into any integral number of bits
* This means the output is not quite compatible with multiprecision conversions,
* but the encoded data retains all the desirable properties of base-62, so (unlike any base-64 encoding) it's URL, DNS, email address and pathname safe
* @author Marcus Bointon <>
* @copyright 2011 Marcus Bointon
* @license MIT License