Skip to content

Instantly share code, notes, and snippets.

@RoryQ
RoryQ / embiggen.js
Created May 30, 2025 03:29
Embiggen
// bookmarklet-title: embiggen
// bookmarklet-about: Embiggen the textarea on the page to 1200px for better readability.
document.querySelector("textarea").style.height = "1200px";
EGET_VERSION=1.3.4
tooldep.eget:
@[[ "$(shell eget -v)" =~ "$(EGET_VERSION)" ]] \
|| go install github.com/zyedidia/eget@v$(EGET_VERSION)
# Go Get Tool command. Installs prebuilt binary if available, with fallback to go install.
# $1: github repo
# $2: version
# $3: sha256
# $4: go install fallback url (default is github repo)
#!/usr/bin/env python3
import os
import argparse
from pathlib import Path
def duplicate_file(input_file: str, output_file: str, target_size: str) -> None:
# Convert size string (like '1GB', '100MB') to bytes
size_map = {'B': 1, 'KB': 1024, 'MB': 1024**2, 'GB': 1024**3}
size_value = float(target_size[:-2])
#!/usr/bin/swift
import Cocoa
// Install with swiftc switchfocus.swift -o switchfocus
// Require command line arguments
guard CommandLine.arguments.count > 1 else {
print("\(CommandLine.arguments[0]): Cycle focus between applications")
print("Example Usage: \(CommandLine.arguments[0]) \"Code\" \"GoLand\" \"Xcode\"")
package xregexp
import "regexp"
func FindMatchGroups(re *regexp.Regexp, s string) (map[string]string, bool) {
matches := re.FindStringSubmatch(s)
return getNamedMatches(re, matches), len(matches) > 0
}
func FindAllMatchGroups(re *regexp.Regexp, s string) ([]map[string]string, bool) {
{
"2024-01-01": "New Year's Day",
"2024-01-26": "Australia Day",
"2024-03-11": "Labour Day",
"2024-04-19": "Good Friday",
"2024-04-20": "Holy Saturday",
"2024-04-21": "Easter Sunday",
"2024-04-22": "Easter Monday",
"2024-04-25": "Anzac Day",
"2024-06-10": "Queen's Birthday",

Managing Tool Versions with asdf and direnv

Managing multiple go versions

This guide will show you how to install multiple versions of go and have the version switch automatically when you change directory.

demo gif

The two main tools used are asdf which is a general tool version manager with support for multiple languages (like nvm, pyenv, rbenv) and programming tools. And direnv

@RoryQ
RoryQ / tools.md
Created May 17, 2022 06:52
Tools and shortcuts

Tools and shortcuts

Raycast - Spotlight and window management, QuickLinks

Karabiner-elements Remap caps to HyperV https://github.com/Vonng/Capslock

https://neovim.io/ Vim with good defaults. Learn the vim movements then enable vim mode in use in Goland, VSCode etc

@RoryQ
RoryQ / renumber.go
Created June 2, 2021 01:56
renumber protobuf model fields to start from one
// This go program will renumber the proto model fields in gen/models starting at 1.
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@RoryQ
RoryQ / tabwriter.go
Last active June 17, 2020 00:42
Golang text/tabwriter
package main
import (
"fmt"
"os"
"text/tabwriter"
)
func main() {
minwidth := 0 // minimal cell width including any padding