Skip to content

Instantly share code, notes, and snippets.

View lstellway's full-sized avatar

Logan Stellway lstellway

View GitHub Profile
@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 / 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;
<?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 / 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();
@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 / distribute
Last active February 22, 2022 22:39
Distribute files in a directory to subfolders based on URL's in a specified file.
#!/bin/bash
# Loop through links
while IFS="" read -r LINE || [ -n "$LINE" ]; do
# Replace domain (everything before "/media")
PATH=${LINE//**\/media/media}
# Get file file name (everything after the last "/")
FILE_NAME=${PATH//*\//}
<?php
/**
* Force Login
*/
function force_login() {
if (!is_user_logged_in()) {
$url = home_url($_SERVER['REQUEST_URI']);
$whitelist = [];
@lstellway
lstellway / photoshop-save-for-web-jpg.jsx
Last active December 22, 2020 16:51
Photoshop Save for Web Script
/**
* Add array indexOf() method
*
* @param {object} Object
* @param {int} max
* @param {int} min)
* @return {mixed}
*/
if (!Array.prototype.indexOf) Array.prototype.indexOf = (function(Object, max, min){
"use strict";
#!/bin/bash
run()
{
/usr/share/elasticsearch/bin/elasticsearch-plugin $1
}
init()
{
# Get installed plugins