Skip to content

Instantly share code, notes, and snippets.

certbot certonly --manual --preferred-challenges dns -d '*.domain.com' -d domain.com
# Will have to add 2 DNS records in separate steps.
# Verify records are there.
nslookup -q=txt _acme-challenge.domain.com
dig -t txt _acme-challenge.domain.com +short
# Place files, if needed.
# Restart webserver.
@kerasai
kerasai / gitlab_docker_image_create.md
Last active September 3, 2019 18:37
Create a docker image

The "magical" whale.

Creating Docker images for GitLab CI

  1. Remove existing image, if needed. See "Misc commands" for details.
  2. Build the new image docker build -t app .

To run a local image

  1. Find the image ID docker images
  2. docker run -t -d --name my_app
@kerasai
kerasai / docker_prune.sh
Last active June 19, 2020 14:39
Docker prune
#!/bin/bash
docker system prune -f
docker image prune -f
docker volume prune -f
@kerasai
kerasai / pantheon_backup.bash
Created October 17, 2019 17:41
Pantheon Backup
#!/bin/bash
terminus backup:create site.env --element db &>/dev/null &
disown
@kerasai
kerasai / dccleanup.sh
Created January 27, 2020 15:45
Docker Container Clean-Up
# TODO: document these.
docker rm -v $(docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null
docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null
@kerasai
kerasai / driver.js
Created April 15, 2020 19:12
Set cookie on lighthouse - ugly hack
// Set request blocking before any network activity
// No "clearing" is done at the end of the pass since blockUrlPatterns([]) will unset all if
// neccessary at the beginning of the next pass.
await passContext.driver.blockUrlPatterns(blockedUrls);
await passContext.driver.setExtraHTTPHeaders(passContext.settings.extraHeaders);
// Add this call for setting the cookie.
await passContext.driver.setCookie();
@kerasai
kerasai / git_clean.sh
Created June 4, 2020 14:52
Clean Git type files from dependencies, when they've got to be committed (barf)
#!/usr/bin/env bash
DEPENDENCY_LOCATIONS=("./drush/Commands/contrib")
DEPENDENCY_LOCATIONS+=("./vendor")
DEPENDENCY_LOCATIONS+=("./web/libraries")
DEPENDENCY_LOCATIONS+=("./web/modules/contrib")
DEPENDENCY_LOCATIONS+=("./web/profiles/contrib")
DEPENDENCY_LOCATIONS+=("./web/themes/contrib")
for DEPENDENCY_LOCATION in "${DEPENDENCY_LOCATIONS[@]}"
@kerasai
kerasai / docker-compose-health.sh
Last active September 28, 2020 14:12
Waits until services report as healthy, all services must have a health check defined.
#!/bin/bash
set -e
# Grab args, shift first off as the timeout.
END=$((SECONDS+$1))
shift
SERVICES=( $@ )
# Wait for the services to report as healthy.
@kerasai
kerasai / git_delete_merged.sh
Last active February 16, 2021 15:39
Delete merged git branches
# Delete local branches.
git branch --merged main | grep -v "\* main" | xargs -n 1 git branch -d
# Delete local branches (seems to remove only some).
git remote prune origin
# Delete remote branches (dry run).
git branch -r --merged origin/main | grep -v 'origin/main' | sed -E 's/(origin\/)//'
# Delete remote branches (for real).
git branch -r --merged origin/main | grep -v 'origin/main' | sed -E 's/(origin\/)//' | xargs -n 1 -I % git push origin :%
@kerasai
kerasai / behat.yml
Created October 21, 2020 19:25
Behat w/Self Signed Certs
default:
extensions:
Behat\MinkExtension:
base_url: https://mysite.local
goutte:
guzzle_parameters:
verify: false