Skip to content

Instantly share code, notes, and snippets.

View L422Y's full-sized avatar
🤓

Larry Williamson L422Y

🤓
View GitHub Profile
@L422Y
L422Y / setup-ses-route53.sh
Created November 1, 2023 14:19
Setup Amazon SES and DKIM verification with Route53
#!/bin/bash
# example: ./setup-ses-route53.sh <hosted-zone-id> <domain>
# Check if the correct number of arguments are provided
if [[ "$#" -ne 2 ]]; then
echo "Usage: $0 <hosted-zone-id> <domain>"
exit 1
fi
@L422Y
L422Y / ResponsivePanes.ts
Created October 29, 2023 04:51
ResponsivePanes: Vue 3 Component which takes a "components" property for using different parent and child components based on viewport width
import type { Component, Ref } from "vue"
import { defineComponent, h, onBeforeUnmount, onMounted, ref } from "vue"
/**
* ResponsivePanes is a component that renders its children in a responsive manner.
*
* @example
* <ResponsivePanes :components="[
* { parent: BAccordion, child: BAccordionItem }, // Mobile/Small (default)
* { parent: BTabs, child: BTab, minWidth: 768 }, // Tablet/Medium
@L422Y
L422Y / install-pimox7-opi5.sh
Last active April 4, 2023 13:36
shell script to download and run the pimox7 installer for arm64
#!/bin/sh
# These steps are copied directly from the post here: https://www.reddit.com/r/Proxmox/comments/104z8pt/comment/jewwf7u/
sudo -s
curl https://raw.githubusercontent.com/pimox/pimox7/master/RPiOS64-IA-Install.sh > RPiOS64-IA-Install.sh
chmod +x RPiOS64-IA-Install.sh
./RPiOS64-IA-Install.sh
@L422Y
L422Y / LatestEvents.gql
Last active March 20, 2023 14:27
WPGraphQL Custom Resolver: The Events Calendar PRO
{
events(first: 10, where: {status: PUBLISH}) {
edges {
node {
uri
title
cost
costMax
costMin
content
@L422Y
L422Y / nuxt3-pm2-build-deploy-on-arm.yaml
Last active April 4, 2024 13:00
Github Actions Workflow to build and deploy Nuxt 3 SSR with PM2, as well as node-canvas, on ARM64, utilizing cache for `pnpm` and `apt` including the build for `node-canvas`
name: "Build and deploy Nuxt SSR with PM2"
on: [push]
jobs:
build:
name: "Build Nuxt Application"
runs-on: [self-hosted, ARM64] # you can also use buildjet.com
environment:
name: "Production"
steps:
- uses: actions/checkout@v3
@L422Y
L422Y / random-web3-provider.js
Last active January 4, 2022 17:17
random web3 provider - check if your provider is connected, pick another at random if not and keep trying
let setupProvider = async () => {
const endpoints = [
'https://bsc-dataseed1.defibit.io/',
'https://bsc-dataseed.binance.org/',
'https://bsc-dataseed1.ninicoin.io/',
'https://bsc-dataseed2.defibit.io/',
'https://bsc-dataseed3.defibit.io/',
'https://bsc-dataseed4.defibit.io/',
'https://bsc-dataseed2.ninicoin.io/',
'https://bsc-dataseed3.ninicoin.io/',
// adapted from https://stackoverflow.com/a/61121577/887164
// replace `adsbygoogle` in your ad unit class name with `ADSENSE`
let _rsztmr;
// call to updateAds after resize (debounced)
window.onresize = function () {
clearTimeout(_rsztmr);
_rsztmr = setTimeout(updateAds, 100);
}
@L422Y
L422Y / dequeue-cf7.php
Created December 13, 2018 18:05
Dequeue Contact Forms 7 scripts and reCaptcha from WordPress pages without forms
// career posts and the page w/ ID 13 both have forms,
// as long as we are not on one of those, we
// dequeue CF7 and reCaptcha to remove the v3 badge
// add to functions.php
add_action('wp_print_scripts', function () {
global $post;
$is_career = (is_single() && $post->post_type == 'career');
if (!$is_career && !is_page(array('13'))) {
@L422Y
L422Y / update-stage.sh
Last active November 8, 2018 03:10
Script to automate updating a staged WordPress site from a local dev environment and clear caches
#!/bin/bash
#
# Author: Larry Williamson - hitmeup@l422y.com
# Script to automate updating a staged WordPress site from a local dev environment and clear PageSpeed
# and NGiNX fastcgi caches. Skips uploading node_modules.
#
# 1) Update WordPress (Understrap) version in style.css so browsers will refresh the new version
# 2) use lftp w/ sftp to reverse mirror files w/ 20 parallel connections (FAST.)
# 3) use SSH to remotely execute a cache clearing script
@L422Y
L422Y / unlocker.applescript
Created July 20, 2018 00:13
Tool to delete InDesign and InCopy lock files
set dir to ""
on open dropped_dir
set dir to dropped_dir
end open
if length of dir is equal to 0 then
set dir to (choose folder with prompt "Choose a folder to scan for lock files")
end if
set list_of_files to {}