Skip to content

Instantly share code, notes, and snippets.

unfurling wet spaghetti

Kyle Taylor kyletaylored

unfurling wet spaghetti
View GitHub Profile
kyletaylored / get_creds.php
Created Sep 30, 2021
Get Pantheon public database credentials for external integration
View get_creds.php
* This is a script to retrieve DB credentials for database connections
* Check IP address function
kyletaylored / multisite-lando-config.yml
Last active Sep 30, 2021
Lando WordPress Network Site / Multisite (WPMS)
View multisite-lando-config.yml
# Using the pantheon recipe / wordpress_network framework, we add a config to the
# appserver_nginx service to use our own server and vhost files. Copy the files lando
# uses and on the wordpress_network.conf.tpl and added wp/ to the rewrite
# rules so lando knows where our WP files live within our Bedrock setup.
type: nginx
ssl: true
server: 'private/config/lando/nginx.conf.tpl'
kyletaylored / gs.php
Created Sep 11, 2021
Using custom bin / exe on Pantheon
View gs.php
// Ghostscript example
// Disable cache
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
echo "<pre>";
kyletaylored / fetch.php
Created Sep 3, 2021
Simple PHP fetch command
View fetch.php
* Simple PHP Fetch command
* @param string $method
* @param string $url
* @param string $body
* @param array $headers
* @return void
function fetch(string $method, string $url, string $body, array $headers = []) {
kyletaylored / package.json
Created Jul 12, 2021
Traffic simulator in a node script
View package.json
"name": "traffic-simulator",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"keywords": [],
"author": "",
View get-creds.php
* This is a script to retrieve DB credentials for database connections
* Check IP address function
function checkIPAddress() {
$allowed_ips_array = file(getcwd() . "/private/dbcr/allowed_ips.txt", FILE_IGNORE_NEW_LINES) or die("Unable to open ip list file!");
kyletaylored / .gitignore
Last active Nov 20, 2020
Terminus Site Inventory
View .gitignore
kyletaylored / asynchronous-vs-parallel-bash-processes.markdown
Last active Sep 29, 2020
Asynchronous vs Parallel Bash Processes
View asynchronous-vs-parallel-bash-processes.markdown

Asynchronous vs Parallel Bash Processes


Terminus is a process-driven, Symfony console application that implements cURL requests using PHP in the background to the Terminus API. There are some performance bottlenecks in the current implementation:

  • Core (and contributed plugin) mass functions run commands serially, looping over a list of sites, and waiting for each site process to complete.
  • Terminus API implements request timeouts when too many requests are submitted at once (but does provide automated retries).
  • Terminus doesn't have a good dependency management system when creating new plugins.
View wp-cfm-import-update.php
print("\n==== WP-CFM Config Import Starting ====\n");
// Activate the wp-cfm plugin
exec('wp plugin activate wp-cfm 2>&1');
// Automagically import config into WP-CFM site upon code deployment
$env = (!empty($_ENV['PANTHEON_ENVIRONMENT']) && !in_array($_ENV['PANTHEON_ENVIRONMENT'], ['test', 'live'])) ? 'dev' : $_ENV['PANTHEON_ENVIRONMENT'];
$path = $_SERVER['DOCUMENT_ROOT'] . '/private/config/' . $env;
$files = array_diff(scandir($path), array('.', '..'));
kyletaylored /
Last active May 19, 2020
IPInfo script for GeoIP detection
import requests
from dotenv import load_dotenv
from netaddr import IPAddress
import os
import pickledb
import codecs
import csv
import argparse
from tqdm import tqdm
from pprint import pprint