Skip to content

Instantly share code, notes, and snippets.

View luckman212's full-sized avatar

Luke Hamburg luckman212

View GitHub Profile
@luckman212
luckman212 / .env
Last active September 3, 2023 01:27
docker-compose config for speedtest-tracker + MariaDB on Synology
# place in same dir as compose.yml, adjust as needed for your environment
# create a limited user and run `id <username>` to get the PUID/PGID values
TZ=America/New_York
CNAME=speedtest
DOCKER_DIR=/volume1/docker
PUID=1030
PGID=100
MARIADB_DATABASE=speedtest-tracker
MARIADB_USER=speedy
@jwmcgettigan
jwmcgettigan / bitwarden_duplicate_cleaner.py
Last active June 1, 2024 00:37
Identifies and removes duplicate 'items' and 'folders' from your Bitwarden vault. 🎃
#!/usr/bin/env python3
# Copyright © 2023 Justin McGettigan
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
# and associated documentation files (the “Software”), to deal in the Software without
# restriction, including without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or
#!/bin/sh
# This is an example script to force provision a UniFi network device using the controller API
# If you are running this externally then replace localhost with the hostname
baseurl=https://localhost:8443
# I would make a dedicated admin user for this
username=<username_here>
password=<password_here>
@luckman212
luckman212 / pwgen-dw.py
Last active January 25, 2023 15:01
small wrapper around diceware (https://pypi.org/project/diceware) to implement multiple passphrase generation
#!/usr/bin/env python3
"""
generates multiple random passphrases in one go
https://github.com/ulif/diceware/issues/53
requires diceware: pip install diceware
"""
import os
@luckman212
luckman212 / syno_hb_hcio.sh
Last active March 24, 2024 14:42
Script to ping healthchecks.io if Synology HyperBackup was successful
#!/usr/bin/env bash
ENDPOINT='https://hc-ping.com/{insert-HealthChecks-UUID-here}'
LOGFILE='/var/log/synolog/synobackup.log'
[[ -e $LOGFILE ]] || exit 1
awk -f- $LOGFILE <<'EOF'
BEGIN {
FS="\t";
@luckman212
luckman212 / imessage-i-mean-what-i-type.sh
Last active October 13, 2022 05:00
Possible fix for iMessage text mangling
#!/usr/bin/env bash
# ref:
# https://forums.macrumors.com/threads/smart-quotes-forced-on-in-messages.2284346/post-30657259
_res() {
(( res += $1 ))
}
res=0
<%*
//v0.2 - bug fix: when search results match just a file name and no line contents under it
//User can set the following two parameters
const resultFilePrefix = '## ';
const folderLocation = '/search';
const search = app.workspace.getLeavesOfType("search")[0];
const searchTerms = search.view.getQuery();
const arrCount = Array.from(search.view.dom.resultDomLookup);
@luckman212
luckman212 / Insert current search as a markdown link.js
Last active April 8, 2022 15:17
Templater: Insert current search as a markdown link
@luckman212
luckman212 / float.lua
Last active April 15, 2023 15:13
WIP of my floating window preview project for Hammerspoon
--[[ Live-updating floating windows at your service!
https://www.hammerspoon.org/docs/hs.window.html
https://www.hammerspoon.org/docs/hs.canvas.html
https://www.hammerspoon.org/docs/hs.image.html
https://www.hammerspoon.org/docs/hs.mouse.html
https://www.hammerspoon.org/docs/hs.timer.html
https://www.lua.org/manual/5.4/manual.html#6.2 (coroutines)
https://github.com/Hammerspoon/hammerspoon/issues/2710#issuecomment-788266990 (thanks @asmagill)

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}