Skip to content

Instantly share code, notes, and snippets.

View LoveDuckie's full-sized avatar
🤓
Hacking mainframes

Luc Shelton LoveDuckie

🤓
Hacking mainframes
View GitHub Profile
@LoveDuckie
LoveDuckie / _config.php
Created February 28, 2022 13:41
A configuration snippet for integrating memcached caching support with SliverStripe.
<?php
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Core\Cache\MemcachedCacheFactory;
$cacheClient = new Memcached();
$cacheClient->addServer('your-memcached-server-hostname-goes-here', 11211);
$cacheFactory = new MemcachedCacheFactory($cacheClient);
Injector::inst()->registerService($cacheFactory, "SilverStripe\\Core\\Cache\\CacheFactory");
Injector::inst()->registerService($cacheFactory, "CacheFactory");
@LoveDuckie
LoveDuckie / amifind.sh
Last active July 17, 2022 19:08 — forked from vancluever/amifind.sh
Get latest Ubuntu AMI ID for AMD64
#!/bin/sh
# Use AWS CLI to get the most recent version of an AMI that
# matches certain criteria. Has obvious uses. Made possible via
# --query, --output text, and the fact that RFC3339 datetime
# fields are easily sortable.
export AWS_DEFAULT_REGION=us-east-1
aws ec2 describe-images \
@LoveDuckie
LoveDuckie / nginx-webp-silverstripe-example.conf.template
Last active August 12, 2022 12:27
This NGINX configuration can be used with Silverstripe for automatically serving generated .webp image assets. You can read more about that here: https://blog.theloveduckie.codes/automatically-serve-webp-images-with-silverstripe-and-nginx
map $http_accept $webp_suffix
{
default "";
"~*webp" ".webp";
}
server
{
listen 80;
listen [::]:80;
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}]
@=""
[HKEY_CURRENT_USER\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32]
@=""
@LoveDuckie
LoveDuckie / eurovision2023.gs
Created May 13, 2023 00:04
eurovision-2023.exe
function GetAllSheetNames(time) {
var out = new Array()
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
for (var i=0 ; i<sheets.length ; i++) {
if (sheets[i].getName() != "Overview") {
out.push( [ sheets[i].getName() ] )
}
}
@LoveDuckie
LoveDuckie / get_certificate_fingerprint.sh
Created June 23, 2023 10:32
A simple shell script function for retrieving the fingerprint of a certificate. Useful for determining whether a certificate is already present in a keychain on macOS.
write_error() {
MSG=$2
echo -e "\033[1;31m$1\033[0m \033[0;37m${MSG}\033[0m" 1>&2
return 0
}
get_certificate_fingerprint() {
if [ -z "$1" ]; then
write_error "shared_functions" "The certificate file path was not defined."
return 1
@LoveDuckie
LoveDuckie / is_process_running.sh
Created June 23, 2023 10:34
A simple script for determining whether a process is running on the local system.
is_process_running() {
if [ -z "$1" ]; then
write_error "shared_functions" "The process ID was not defined as the first parameter."
fi
if ps -p $1 >/dev/null; then
return 0
fi
return 1
}