Skip to content

Instantly share code, notes, and snippets.

View lstellway's full-sized avatar

Logan Stellway lstellway

View GitHub Profile
@lstellway
lstellway / GIF-Screencast-OSX.md
Created May 30, 2020 00:36 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@lstellway
lstellway / Google Spreadsheet Post
Created June 25, 2020 05:19
Post data to a Google Spreadsheet
/**
* @see http://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
* @see https://gist.github.com/willpatera/ee41ae374d3c9839c2d6
*/
// Sheet name
const SHEET_NAME = "Submissions";
// Property service
const ScriptProps = PropertiesService.getScriptProperties();
<?php
/*
Plugin Name: GraphQL Meta Queries
Plugin URI: https://loganstellway.com
Description: Extends WPGraphQL to allow meta queries on post connections
Version: 0.0.1
Author: Logan Stellway
Author URI: https://loganstellway.com
*/
<?php
/*
Plugin Name: GraphQL Meta Queries
Plugin URI: https://loganstellway.com
Description: Extends WPGraphQL to allow meta queries on post connections
Version: 0.0.1
Author: Logan Stellway
Author URI: https://loganstellway.com
*/
@lstellway
lstellway / NGINX Config - IP Address JSON
Created January 15, 2021 21:19
Simple NGINX config to return real client IP address
map ":$http_x_forwarded_for" $IP_ADDR {
":" $remote_addr; # Forwarded for not set
default $http_x_forwarded_for; # Forwarded for is set
}
server {
server_name example.com;
listen 80;
listen [::]:80;
@lstellway
lstellway / synology-dsm-getcert.sh
Last active February 23, 2022 02:45
Shell utility to help find the certificates used by a specified FQDN on Synology NAS
#!/bin/sh
# Help
if [ "$1" == "-h" -o "$1" == "--help" ]; then
SCRIPT="$(basename ${0})"
cat <<EOF
${SCRIPT}
Shell utility to help find the certificates used by a specified FQDN on Synology NAS
Usage
@lstellway
lstellway / operator.yml
Created February 4, 2022 21:17
PlanetScale.com - Vitess Operator for Kubernetes `v1.21.1`
# Version: 20200918: 25ca1bc881f433d2a42c3b5f59da416f4ef6dc44
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: etcdlockservers.planetscale.com
spec:
group: planetscale.com
@lstellway
lstellway / macos-change-ssh-port.sh
Last active June 10, 2023 21:49
Change the default SSH port on macOS
# Setup SSH port
SYSTEM_SSH_PLIST="/System/Library/LaunchDaemons/ssh.plist"
ssh_set_port() {
# Ensure a port is specified
if [ -z "$1" ]; then
printf "No port specified...\n"
return 1
fi
@lstellway
lstellway / update-mysql-letsencrypt
Created February 23, 2022 02:35
Helper script to update MySQL / MariaDB TLS after renewing LetsEncrypt certificate
#!/bin/bash
DOMAIN="$1"
SOURCE="/etc/letsencrypt/live/${DOMAIN}"
DESTINATION="/var/lib/mysql/pki"
USER="mysql."
# Validate provided domain
if [ -z "${DOMAIN}" ] || [ ! -d "${SOURCE}" ]; then
printf "Please enter a valid domain (provided '%s')\n" "${DOMAIN}"
@lstellway
lstellway / timer.sh
Last active March 2, 2022 23:41
Shell-based timer for `bash` and `zsh`
# Read a message using the OSX `say` command
#
# In my opinion, the best voices for American English seem to be:
# 'Daniel', 'Karen', 'Rishi', 'Tessa'
export TIMER_COMMAND="say -v Karen --interactive=bold '%s'"
# Hide tty input while command is running
_timer_tty_off() {
[ -t 0 ] && stty -echo -icanon time 0 min 0
}