Skip to content

Instantly share code, notes, and snippets.

View chockenberry's full-sized avatar

Craig Hockenberry chockenberry

View GitHub Profile
@chockenberry
chockenberry / tot.sh
Last active April 21, 2026 07:36
A shell script for Tot
#!/bin/sh
basename=`basename $0`
if [ -z "$*" ]; then
echo "usage: ${basename} <dot> [ -o | -r | <file> | - ]"
echo ""
echo "options:"
echo " -o open dot in window with keyboard focus"
echo " -r read contents of dot"
@chockenberry
chockenberry / server_stats.rb
Created April 8, 2026 18:12
A simple Ruby script to gather and display uptime, load average, memory usage, and network activity.
require 'time'
now = Time.now
boottime = `/usr/sbin/sysctl kern.boottime`
begin
timestamp = boottime.split(/\}/).last
boot = Time.parse(timestamp)
@chockenberry
chockenberry / Debug.swift
Last active February 26, 2026 03:46
Debug and release logging in Swift that's reminiscent of NSLog()
//
// Debug.swift
//
// Created by Craig Hockenberry on 3/15/17.
// Updated by Craig Hockenberry on 2/20/24.
// Usage:
//
// SplineReticulationManager.swift:
//
//
// ColorSchemeApp.swift
// ColorScheme
//
// Created by Craig Hockenberry on 9/11/24.
//
import SwiftUI
@main
#!/bin/sh
# dfn: df normalized, or df not noisy, or df nicely, or df new
#
# Whatever you want to call it, this script makes df useful again.
# It removes read-only disks for Time Machine backups, system volumes
# that can't be modified, unbrowsable volumes, and other stuff you don't
# really care about.
#
# Instead, you get the same drives that you see on your Mac desktop in an

App Review:

Well, I'm currently sitting at a 4 day wait for a BETA app review of a macOS app. On iOS, it typically takes less than a day.

Same with incremental releases on the same version: it takes so much longer on macOS than iOS.

We go through a lot of effort to make our apps work well across Apple's platforms, you should too.

App Store Users and Accounts

@chockenberry
chockenberry / df.sh
Created March 4, 2024 18:51
df Replacement
#!/bin/sh
if [ ! -z "$*" ]; then
echo "this is ~/bin/df, use /bin/df"
exit 1
fi
protect=`mount | grep -v "read-only" | grep "protect" | cut -f 3 -w`
nosuid=`mount | grep -v "read-only" | grep "nosuid" | cut -f 3 -w`
@chockenberry
chockenberry / AttributedString.swift
Created June 1, 2022 21:08
A playground that shows how to use Swift's AttributedString with Markdown
import UIKit
import Foundation
// NOTE: This playground shows how to use Swift's AttributedString with Markdown.
//
// This code was used to display Markdown content in the Tot iOS Widget <https://tot.rocks>
// MARK: - Helpful Links
// NOTE: The following links helped me figure this stuff out.
@chockenberry
chockenberry / TestApp.swift
Created December 19, 2024 23:06
Swipe actions breaking ShareLink()
//
// TestApp.swift
// TestApp
//
// Created by Craig Hockenberry on 12/19/24.
//
import SwiftUI
@main
@chockenberry
chockenberry / ContentView.swift
Created April 18, 2024 21:21
Observable with backing store
//
// ContentView.swift
// ObservableTester
//
// Created by Craig Hockenberry on 4/18/24.
//
import SwiftUI
class BackingStore {