Skip to content

Instantly share code, notes, and snippets.

@pbowyer
pbowyer / Mailhog Bash Script (systemd)
Created January 17, 2020 10:57 — forked from v-jacob/Mailhog Bash Script (systemd)
Mailhog setup with systemd
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
# Make it executable
chmod +x ~/mailhog
@pbowyer
pbowyer / criteria-to-query-builder.php
Created August 23, 2018 07:48 — forked from jgornick/criteria-to-query-builder.php
Doctrine: Criteria Array to Doctrine QueryBuilder
<?php
/**
* Recursively takes the specified criteria and adds too the expression.
*
* The criteria is defined in an array notation where each item in the list
* represents a comparison <fieldName, operator, value>. The operator maps to
* comparison methods located in ExpressionBuilder. The key in the array can
* be used to identify grouping of comparisons.
*
@pbowyer
pbowyer / umap_sparse.py
Created August 22, 2018 10:59 — forked from johnhw/umap_sparse.py
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@pbowyer
pbowyer / README.md
Created January 25, 2018 11:06
BuzzFeed's README Template

name of the service

An explanation of what the service is doing and why. Any high level business logic should be mentioned here to give the reader an understanding of why the service exists in the first place.

List important endpoints/URLs and explain what they are responsible for.

Point of contact and Slack channel

@pbowyer
pbowyer / configure-mailgun
Created October 7, 2016 08:02 — forked from jgeewax/configure-mailgun
Script to configure Postfix for Mailgun
#!/bin/bash
# Configuration for the script
POSTFIX_CONFIG=/etc/postfix/main.cf
POSTFIX_SASL=/etc/postfix/sasl_passwd
function confirm () {
read -r -p "${1:-Are you sure? [Y/n]} " response
if [[ $response == "" || $response == "y" || $response == "Y" ]]; then
echo 0;
<?php
class My_Walker_Nav_Menu extends Walker_Nav_Menu {
function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
if ( !$element )
return;
$id_field = $this->db_fields['id'];
@pbowyer
pbowyer / php_oboe functions
Created April 26, 2016 16:48 — forked from rsalmond/php_oboe functions
AppNeta php_oboe function signatures
<?php
/**
* Oboe API for PHP
*
* This can be used for autocompletion in many major PHP editors
* provides documentation for the code
* and can be used on systems where the oboe extension is not loaded
* to provide no-op versions of functionality
*/
$ = jQuery;
/*
* jQuery BBQ: Back Button & Query Library - v1.3pre - 8/26/2010
* http://benalman.com/projects/jquery-bbq-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
@pbowyer
pbowyer / GTiff_compression_benchmark.py
Last active November 1, 2015 09:17 — forked from kr-stn/GTiff_compression_benchmark.py
Benchmark filesize and read/ write times for various GeoTiff compression algorithms
__author__ = 'kersten.clauss'
"""Benchmark different GeoTiff compression algorithms.
Usage: GTiff_compression_benchmark.py some_geo.tif
Requires the GDAL tools to be present and executable from the command line of your system.
This script will take a GeoTiff as input and create copies with different compression algorithms from it.
It measures the filesize, compression and decompression times and returns them as a table.
<?php
//Deletes all CSS classes and id's, except for those listed in the array below
function custom_wp_nav_menu($var) {
return is_array($var) ? array_intersect($var, array(
//List of allowed menu classes
'current_page_item',
'current_page_parent',
'current_page_ancestor',
'first',
'last',