Skip to content

Instantly share code, notes, and snippets.

View swichers's full-sized avatar
👻
We must construct additional pylons!

Steven Wichers swichers

👻
We must construct additional pylons!
View GitHub Profile
@swichers
swichers / repman-sync-all.sh
Created March 14, 2024 23:11
Re-syncs all repositories under a repman organization
#!/bin/env bash
# Requires HTTPie and JQ
# Usage repman-sync-all.sh orgname apikey
# Check if jq and http exist
command -v jq >/dev/null 2>&1 || { echo >&2 "jq is required but it's not installed. Aborting."; exit 1; }
command -v http >/dev/null 2>&1 || { echo >&2 "http (HTTPie) is required but it's not installed. Aborting."; exit 1; }
# Function to display usage information
usage() {
@swichers
swichers / docker-compose.yml
Created September 21, 2021 01:27
Route specific SSH traffic through a Docker VPN
# This is useful to have an isolated VPN setup that lets you route SSH traffic
# without touching other traffic on the host.
#
# SETUP:
# mkdir ./config
# cat ~/.ssh/id_rsa.pub > config/bastion_keys
# cp path/to/your.ovpn config/
# chmod 0700 config
# chmod 0400 config/bastion_keys
# chown -R 4096:4096 config
@swichers
swichers / write-to-acquia-log-stream.sh
Created December 16, 2020 23:40
Write log lines to the syslog in a way that the Acquia log streamer will show them.
#!/usr/bin/env bash
# Write log lines to the syslog in a way that the Acquia log streamer
# will show them.
WATCHDOG_NAME='Logging Example'
# General logging to syslog.
log() {
(>&2 echo "${1}")
if [[ ! -z "${AH_SITE_NAME}" ]]; then
@swichers
swichers / provisions.html
Last active August 17, 2019 01:52
A simple, filterable list of provisions for DND
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Provision List</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
<script defer src="https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
</head>
<body>
@swichers
swichers / gist:bbc28deabd76ad25f09c186b09c128a8
Last active November 10, 2019 08:47
Checks for shared file modifications within a commit range
Moved to https://github.com/swichers/code-management-scripts
@swichers
swichers / jsonapi.vcl
Created August 1, 2018 22:22
Varnish VCL for checking authorization against a different page and then forcing a cached response.
vcl 4.0;
# !!Important!! Do not use this if your authenticated response can vary
# between users or roles.
# Note: This is only useful if the following things are true:
# * Access to the jsonapi endpoints is restricted to authorized users only.
# * jsonapi request results will be the same for all authorized users. No
# customized or filtered results based on role or other access checks.
@swichers
swichers / frontend-reqs.sh
Created July 24, 2018 06:04
BLT frontend-reqs script for multiple themes
#!/usr/bin/env bash
set -e
THEME_PATH=../../docroot/themes/custom
for THEME_FOLDER in "${THEME_PATH}"/*; do
if [ -d "${THEME_FOLDER}/npm" ]; then
THEME=${THEME_FOLDER%*/}
THEME=${THEME##*/}
@swichers
swichers / d8-bundle-autocomplete.patch
Created April 5, 2018 22:03
Adding the entity bundle to the autocomplete results
diff --git a/docroot/modules/custom/custom_utils/custom_utils.services.yml b/docroot/modules/custom/custom_utils/custom_utils.services.yml
index 006b5d51..98868011 100644
--- a/docroot/modules/custom/custom_utils/custom_utils.services.yml
+++ b/docroot/modules/custom/custom_utils/custom_utils.services.yml
@@ -1,3 +1,11 @@
services:
custom_utils.controller.fieldscontroller:
- class: Drupal\custom_utils\Controller\FieldsController
\ No newline at end of file
+ class: Drupal\custom_utils\Controller\FieldsController
@swichers
swichers / AcsfUtility.php
Created March 29, 2018 19:02
Bootstrap-less ACSF utility for getting site names
<?php
namespace Acquia\Blt\Custom\Acsf;
use Symfony\Component\Yaml\Yaml;
use Consolidation\Config\Loader\YamlConfigLoader;
use Acquia\Blt\Robo\Config\YamlConfigProcessor;
/**
* ACSF utility functions for determining which ACSF site is currently running
@swichers
swichers / rebuild_field_map.d8.drush.inc
Created November 23, 2017 00:07
drush 8 command to rebuild Drupal 8 field mappings
<?php
/**
* @file
* Drush command implementation for rebuild-field-map.
*
* This will allow rebuilding the field mapping stored in the key value store
* for a given entity type. This is helpful when trying to repair a corrupted
* field map store without having to add and remove fields.
*/