Skip to content

Instantly share code, notes, and snippets.

View dir's full-sized avatar
making it happen

Luke Davis dir

making it happen
View GitHub Profile
@dir
dir / bundle-identifier-to-path.sh
Created January 15, 2026 04:22
macOS Bundle Identifier Helper Scripts
#!/usr/bin/env bash
#
# bundle-identifier-to-path.sh - Get the path of an app by its bundle identifier
#
bundle_id="${1:-$(< /dev/stdin)}"
[[ -z $bundle_id ]] && echo "Usage: ${0##*/} <bundle id>" && exit 1
# Try mdfind first (faster, uses Spotlight index)
path=$(mdfind "kMDItemCFBundleIdentifier == '$bundle_id'" 2> /dev/null | head -1)
@dir
dir / simple_arg_parse.sh
Last active January 14, 2026 19:16
Bash simple args/options/flags parsing snippet
#!/usr/bin/env bash
parse_args() {
local foo
local bar=false
local positional_args=() # < this line can technically be omitted, if you want to go very minimal
while [[ $# -gt 0 ]]; do
case "$1" in
# CLI Options
@dir
dir / biome.ts
Last active December 1, 2025 21:09
@t3-oss/t3-env Presets (Zod)
import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";
/**
* Biome Environment Variables
*
* @see https://biomejs.dev/reference/environment-variables
*/
export const biome = (): Readonly<{
/**
@dir
dir / nanoid-3.3.11.min.cjs
Last active July 24, 2025 23:58
Postman Package Library
let t="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",e=t=>crypto.getRandomValues(new Uint8Array(t)),r=(t,e,r)=>{let n=(2<<Math.log(t.length-1)/Math.LN2)-1,l=-~(1.6*n*e/t.length);return(o=e)=>{let a="";for(;;){let e=r(l),g=0|l;for(;g--;)if(a+=t[e[g]&n]||"",a.length===o)return a}}},n=(t,n=21)=>r(t,n,e),l=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_"),"");module.exports={customAlphabet:n,customRandom:r,nanoid:l,random:e,urlAlphabet:t};module.exports.default=null;
//# sourceMappingURL=https://cdn.jsdelivr.net/sm/2bcc6c4870702ad675061bedae7ea2c4af9274577d2bce6e749ab8c564d06b45.map
@dir
dir / init.sh
Last active June 17, 2025 02:33
NixOS Test
#!/bin/bash
echo "Hello world 12345"
@dir
dir / spotify-player-app-schema.json
Last active May 27, 2025 17:56
JSON Schemas for spotify-player TOML configuration files
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Spotify Player Configuration",
"description": "JSON schema for spotify-player app.toml configuration file",
"type": "object",
"properties": {
"client_id": {
"type": "string",
"description": "The Spotify client's ID",
"default": "65b708073fc0480ea92a077233ca87bd"
@dir
dir / figma-agent-remove
Last active March 7, 2025 22:06
Bash script to remove Figma Agent login item & FigmaAgent.app(s) from your Mac
#!/usr/bin/env bash
#
# figma-agent-remove
# Removes Figma Agent from launchctl & deletes Figma Agent apps
# - This script may require sudo privileges.
# - You will likely have to re-run this script after every Figma update.
# - You will need to restart your system for changes to take effect.
# - After restarting, you may have to manually remove FigmaAgent from Login Items one last time.
FIGMA_AGENT_LAUNCHCTL_IDENTIFIER="application.com.figma.agent"
audio.allow_downgrade=false
audio.normalize_v2=false
audio.sync_bitrate_enumeration=4
audio.play_bitrate_enumeration=4
audio.play_bitrate_non_metered_migrated=true
audio.play_bitrate_non_metered_enumeration=4
@dir
dir / zendesk-web-widget.d.ts
Last active March 11, 2025 18:12
Global TypeScript type definitions for the Zendesk Web Widget embed
/**
* Type definitions for the Zendesk Web Widget
*
* @see {@link https://developer.zendesk.com/api-reference/widget-messaging/introduction/#web-widget}
*/
/**
* Callback function for Zendesk Web Widget events
*/
type ZendeskCallback = () => void;
@dir
dir / README.md
Last active February 14, 2025 03:35
Postman Package Library script to convert XML responses to JS/JSON objects

Usage

  1. Add the script to your Postman Package Library, call it whatever you'd like.
  2. Import it in any of your Postman scripts using pm.require("package-name")

Example

const { parse } = pm.require("xml"); // assuming package is named xml

const xmlResponseString = pm.response.text();