Skip to content

Instantly share code, notes, and snippets.

View luckman212's full-sized avatar

Luke Hamburg luckman212

View GitHub Profile
@drewkerr
drewkerr / get-focus-mode.js
Last active October 10, 2025 07:11
Read the current Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
const app = Application.currentApplication()
app.includeStandardAdditions = true
function getJSON(path) {
const fullPath = path.replace(/^~/, app.pathTo('home folder'))
const contents = app.read(fullPath)
return JSON.parse(contents)
}
function run() {
<%*
//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);
@tomdaley92
tomdaley92 / README.md
Last active October 21, 2025 23:56
Proxmox - SPICE Client setup for MacOS

Proxmox - SPICE client setup for MacOS

  1. Install a working (and compiled) version of virt-viewer. You may view the homebrew package's upstream source on GitHub.

    brew tap jeffreywildman/homebrew-virt-manager
    brew install virt-viewer
  2. Once that's installed should be able make a call remote-viewer with a pve-spice.vv file downloaded from proxmox web interface

@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]}
@darrenpmeyer
darrenpmeyer / decrypt-howto.md
Created December 23, 2020 02:36
Decrypt Unifi .unf backups

NB: these instructions are for Ubuntu; they work under WSL on Windows 10 as well

Get the decrypt.sh file from here: https://github.com/zhangyoufu/unifi-backup-decrypt

Make sure prerequisites are installed:

sudo apt update && sudo apt install zip unzip openssl mongo-tools
@liamcain
liamcain / obsidian-pagebreaks.css
Created November 8, 2020 01:04
Obsidian Pagebreaks
/**
Create pagebreaks in exported Obsidian PDFs.
Example:
# Heading 1
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type
@jamesmacwhite
jamesmacwhite / README.md
Last active June 18, 2025 07:04
An example and overview of mwan3 IPv6 configuration with NAT6 (sorry anti IPv6 NAT people)

Deploying mwan3 with IPv6 (using NAT6)

I'm a user of mwan3 and contribute to its development in a small way by mainly providing feedback with my multi WAN setup and maintaining the beast of it's documentation on the OpenWrt wiki (feedback and contributors welcome).

This setup ultimately requires the use of a NAT6 firewall script. NAT6 is currently broke with fw3 and LuCI, so this is an important helper script to workaround this current limitation.

The NAT6 configuration requirements are explained in more detail on the OpenWrt wiki.

This gist is aims to document my configuration for others.

#!/bin/sh
CASKNAME="$1"
CASKROOM=$(brew --caskroom)
CASKDIR="$CASKROOM/$CASKNAME"
DATE=$(date +"%Y%m%d%H%M%S.000")
BACKUPDIR="$CASKDIR/.backup"
BLACK='\033[30m'
RED='\033[31m'