Skip to content

Instantly share code, notes, and snippets.

View T1T4N's full-sized avatar
👽

Robert Armenski T1T4N

👽
View GitHub Profile
BASH_ENV=~/.bashrc exec bash -c "$*"
@T1T4N
T1T4N / center-window.swift
Created August 19, 2025 12:18
A short script to center the foremost window on screen
#!/usr/bin/env swift
import AppKit
// Function to get the frontmost window
func getFrontmostWindow() -> AXUIElement? {
guard let app = NSWorkspace.shared.frontmostApplication else {
return nil
}
let appElement = AXUIElementCreateApplication(app.processIdentifier)
@T1T4N
T1T4N / bash-error.sh
Created August 14, 2025 14:07
Getting decent error reports in Bash when you're using 'set -e'
# Source: https://utcc.utoronto.ca/~cks/space/blog/programming/BashGoodSetEReports
trap 'echo "Exit status $? at line $LINENO from: $BASH_COMMAND"' ERR
@T1T4N
T1T4N / classic-context-menu.bat
Last active July 16, 2025 20:41
Windows 11: Use classic context menu by default
:: Source: https://stadt-bremerhaven.de/windows-11-klassisches-kontextmenue-als-standard-aktivieren/
reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
@T1T4N
T1T4N / continue-config-qwen3-rerank.md
Created July 2, 2025 12:02
Continue.dev configuration for using Qwen3 Reranker with transformers.js

config.yaml

models:
 - name: Qwen3 Reranker 0.6B
   provider: transformers.js
   model: zhiqing/Qwen3-Reranker-0.6B-ONNX
   roles:
     - rerank
@T1T4N
T1T4N / continue-config-qwen3-embedding.md
Last active July 2, 2025 12:02
Continue.dev configuration for using Qwen3-Embedding with transformers.js

config.yaml

models:
 - name: Qwen3 Embedding 0.6B
   provider: transformers.js
   model: onnx-community/Qwen3-Embedding-0.6B-ONNX
   roles:
     - embed
@T1T4N
T1T4N / .swiftlint.yml
Last active February 24, 2025 12:17
Default SwiftLint configuration as only_rules
# strict: true
# File organization
# included:
# - Sources
# - Tests
excluded:
- .build
- .swiftpm
- DerivedData
@T1T4N
T1T4N / .swiftformat
Created February 10, 2025 17:00
Default SwiftFormat v0.55.5 rules assembled from the official documentation
--swiftversion 5.9
# Opt-in rule config
--disable all
# Explicitly disabled (opt-in) rules:
# See: https://github.com/nicklockwood/SwiftFormat/blob/main/Rules.md#acronyms
--disable acronyms
@T1T4N
T1T4N / SendingSelf.swift
Created February 3, 2025 00:01
Fix for "Sending 'self' risks causing data races" in Swift 6
// 1. Decorate the class itself with e.g. @MainActor
// 2. If that isn't possible, here is an example workaround:
deinit {
nonisolated(unsafe) let obj = self
MainActor.assumeIsolated {
obj.dismiss(animated: false)
}
}
@T1T4N
T1T4N / PrintHeapAddress.swift
Created February 3, 2025 00:00
Print heap memory address in Swift
print(Unmanaged.passUnretained(self).toOpaque())