Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env fish
# Needs rg: `brew install ripgrep`
set -xg visitedLibs
function libdeps -a bin depth -d "Finds all dylibs that a binary depends on recursively and prints them on separate lines, sorted alphabetically"
if test -z "$depth"
set depth 0
end
import Cocoa
import Foundation
func restart() {
// Check if the app was started fresh or if was restarted with arg `restarts=timestamp:timestamp:...`
// If the app was restarted more than 3 times in 10 seconds, exit with status 1
guard CommandLine.arguments.count == 1 || (
CommandLine.arguments.count == 2 && CommandLine.arguments[1].starts(with: "restarts=")
) else {
// swiftc -o /tmp/InternetReachable ~/Temp/InternetReachable.swift && /tmp/InternetReachable
import AppKit
import Cocoa
import Foundation
import Network
private var window: NSWindow = {
let w = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: NSScreen.main!.frame.width, height: 20),