Skip to content

Instantly share code, notes, and snippets.

@TaylorJadin
TaylorJadin / gtmetrix
Last active Aug 30, 2022
Submit multiple URLS to gtmetrix using their API
View gtmetrix
#!/bin/bash
# Config
GTMETRIX_API_KEY=
SLEEP_TIME=5
# Functions
function submit_test {
curl -s -u $GTMETRIX_API_KEY: \
-X POST -H Content-Type:application/vnd.api+json \
@TaylorJadin
TaylorJadin / docker-compose.yml
Last active Jul 12, 2022
docker compose for nextcloud
View docker-compose.yml
version: '3.3'
services:
app:
image: nextcloud
restart: always
ports:
- '8080:80'
volumes:
- 'nextcloud:/var/www/html'
volumes:
View docker-compose.yml
version: '3.3'
services:
SERVICE_NAME:
image: DOCKERHUB_IMAGE
restart: always
ports:
- 'HOST_PORT:CONTAINER_PORT'
volumes:
- 'VOLUME_NAME_OR_PATH:PATH_INSIDE_CONTAINER'
environment:
View streamdeck-open-close.applescript
set appName to "Stream Deck"
set usbDeviceName to "Stream Deck"
set usbData to do shell script "system_profiler SPUSBDataType -detailLevel basic"
if usbData contains usbDeviceName then
log "Stream Deck connected"
if application appName is running then
log "Stream Deck.app is already running"
else
log "Launching Stream Deck.app"
@TaylorJadin
TaylorJadin / foundryBackup.sh
Created Jan 24, 2022
Backup foundrydata folder
View foundryBackup.sh
#!/bin/bash
FOUNDRYDATA="/home/jelastic/foundrydata"
DESTINATION="/home/jelastic/backups/"
BACKUPS_TO_KEEP=5
TIME_FORMAT=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
slow() {
start=`date +%s`
tar -cvJf "$DESTINATION/foundrydata-$TIME_FORMAT.tar.xz" $FOUNDRYDATA
@TaylorJadin
TaylorJadin / create-local-users.ps1
Created May 25, 2021
Create local users in bulk from a csv using powershell
View create-local-users.ps1
$importCSVpath="C:\users\paperspace\desktop\userlist.csv"
ForEach ($user in (Import-CSV $importCSVpath)){
$password = ConvertTo-SecureString $user.password -AsPlainText -Force
New-LocalUser -Name $user.username -Password $password -FullName $user.fullname
}
@TaylorJadin
TaylorJadin / backup.sh
Last active Apr 16, 2021
piboy pi backup
View backup.sh
#!/bin/bash
output=$1
sd="/dev/mmcblk0"
if [ -z "$output" ]
then
echo "No output path specified."
echo "Example: backup.sh /media/usb1/piboy.img.gz"
exit
@TaylorJadin
TaylorJadin / valhook.py
Last active Mar 30, 2021
Check the player count of a valheim server, then notify on discord if there is a change. This script is designed to run every minute or so in cron. It uses the gamedig cli to get the player count, so this script could work for all sorts of other games with a little modification.
View valhook.py
import subprocess
import json
import os.path
import requests
# This script requires gamedig to be installed: https://github.com/gamedig/node-gamedig#usage-from-command-line
### config ###
webhook_url = "https://discord.com/api/webhooks/..."
gamedig_cmd = "gamedig --type valheim server.address:2457"
@TaylorJadin
TaylorJadin / port-forward.sh
Last active Mar 8, 2021
LXD simple port forwarding
View port-forward.sh
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Usage: ./port-forward.sh [container] [tcp|udp] [port number]"
exit
fi
container="${1}"
protocol="${2}"