Skip to content

Instantly share code, notes, and snippets.


Wayne K. Walrath wkw

View GitHub Profile
wkw / wavefilereader.class.php
Created Dec 7, 2017 — forked from RobThree/wavefilereader.class.php
PHP WAVE file reader / parser
View wavefilereader.class.php
* WaveFileReader; a simple class to read/parse WAVE file
* (c)2012 Rob Janssen /
* Based on
* $wav = WaveFileReader::ReadFile('/path/to/test.wav');
wkw / array-to-texttable.php
Created Sep 29, 2017 — forked from tony-landis/array-to-texttable.php
PHP: Array to Text Table Generation Class
View array-to-texttable.php
* Array to Text Table Generation Class
* @author Tony Landis <>
* @link
* @copyright Copyright (C) 2006-2009 Tony Landis
* @license
class ArrayToTextTable
wkw / wordpress-tinymce.js
Created Sep 28, 2017 — forked from RadGH/wordpress-tinymce.js
Get/Set content of a TinyMCE visual or text editor with JavaScript
View wordpress-tinymce.js
Based on:
These functions provide a simple way to interact with TinyMCE (wp_editor) visual editor.
This is the same thing that WordPress does, but a tad more intuitive.
Additionally, this works for any editor - not just the "content" editor.
wkw / macos-get-ip-address.php
Last active Mar 28, 2020
Mac OS Get Wi-Fi IP address (cmd line or php)
View macos-get-ip-address.php
$ip = trim(exec("ipconfig getifaddr $(networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/{getline; print $2}')", $out, $rc));
echo "$ip\n";
wkw /
Last active Nov 17, 2017 — forked from stuartsierra/
Launch new instances of Google Chrome on OS X with isolated cache, cookies, and user config
#!/usr/bin/env bash
# fresh-chrome
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
wkw / gist:35f75406b6b38ea3eaa1bd114c1e7ed0
Created Feb 3, 2017 — forked from samnang/gist:1759336
Install Bash version 4 on MacOS X
View gist:35f75406b6b38ea3eaa1bd114c1e7ed0
# Install Bash 4 using homebrew
brew install bash
# Or build it from source...
curl -O
tar xzf bash-4.2.tar.gz
cd bash-4.2
./configure --prefix=/usr/local/bin && make && sudo make install
# Add the new shell to the list of legit shells
wkw / wp-parent-page-filter.php
Created Oct 25, 2016
WordPress: allow draft, private posts to be selected in Parent page dropdown
View wp-parent-page-filter.php
* Show draft and private pages in hierarchicial Parent pages dropdown.
* will work for any hier. post type.
function filter_attributes_dropdown_pages_args($dropdown_args) {
$dropdown_args['post_status'] = array('publish','draft', 'private');
return $dropdown_args;
add_filter('page_attributes_dropdown_pages_args', __NAMESPACE__ . '\\filter_attributes_dropdown_pages_args', 100, 1);
wkw / merge-package-json.js
Last active Oct 12, 2016
Nodejs shell script to merge portions of one package.json to another one. requires shelljs and chalk NPM packages. Originally written to Merge EMN Reagent React client package with an ExpressJS Server package.json.
View merge-package-json.js
#!/usr/bin/env node
/* global test, cp, exec */
const chalk = require('chalk');
const format = require('util').format;
const path = require('path');
const writeFile = require('fs').writeFileSync;
// colorize output...
const chalkError =;

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost
wkw / gravity-form.php
Last active Nov 16, 2020 — forked from OutThisLife/gravity-form.php
Custom: Gravity Forms WP API Submission and GF API form entry creation plus send notifications
View gravity-form.php
* Add WP API endpoint for form submission, then create new
* Gravity Forms entry and send notifications.
// rest api endpoint for forms submission
add_action( 'rest_api_init', function () {
register_rest_route( 'ahr/v1', '/forms', array(
'methods' => 'POST',
You can’t perform that action at this time.