Skip to content

Instantly share code, notes, and snippets.

View mbaynton's full-sized avatar

Mike Baynton mbaynton

View GitHub Profile
#!/bin/bash
set -euo pipefail
dd if=/dev/zero of=/swapfile2 bs=1M count=2560
chmod 0600 /swapfile2
mkswap /swapfile2
swapon /swapfile2
swapoff /swapfile
@mbaynton
mbaynton / workflow_caller.js
Created September 13, 2019 23:09
JS ad-hoc Pantheon workflow invocation and status check
// not sure if it's the json.trace_id or json.id that is correct for the second, status check call
dumper = function(response) { console.log(response.status); response.text().then( text => console.log(text) ) }
function checkWorkflow(site_id, env_id, workflow_id) {
p = fetch("/api/sites/" + site_id + "/environments/" + env_id + "/workflows/" + workflow_id, {
credentials: "include",
headers: {
"accept":"*/*",
"accept-language":"en-US,en;q=0.9,de;q=0.8,fr;q=0.7,ro;q=0.6",
"content-type":"application/json; charset=UTF-8",
"sec-fetch-mode":"cors",
@mbaynton
mbaynton / copy-assets.sh
Created April 12, 2019 23:40
Finds web assets that should be served by the webserver and moves them to the docroot
#!/bin/bash
assets=`find core -regex '.*\.\(js\|css\|png\|jpg\|jpeg\|svg\|ico\)$'`
for ASSET in ${assets}; do
dir=$(dirname $ASSET)
if [[ ! -d "../html/$dir" ]]; then
mkdir -p "../html/$dir"
fi
cp -a $ASSET ../html/$ASSET
@mbaynton
mbaynton / docker.sh
Created April 30, 2017 21:10
Docker command for a debuggable Drupal 7 container using prophusion-apache
#!/bin/bash
docker rm d753_curator
docker run -t -v /home/mbaynton/d7.53_curator:/var/www/html -v /usr/local/phpenv/versions -p 80:80 -e 'PHP_VERSION=7.0.18' -e 'XDEBUG2HOST="serverName=d753_curator"' --cap-add SYS_PTRACE --security-opt seccomp:unconfined --name d753_curator -d prophusion/prophusion-apache
@mbaynton
mbaynton / lwnfs.c
Last active January 4, 2016 21:29 — forked from prashants/lwnfs.c
/*
* Demonstrate a trivial filesystem using libfs.
*
* Copyright 2002, 2003 Jonathan Corbet <corbet@lwn.net>
* This file may be redistributed under the terms of the GNU GPL.
*
* Chances are that this code will crash your system, delete your
* nethack high scores, and set your disk drives on fire. You have
* been warned.
*/