Skip to content

Instantly share code, notes, and snippets.

View edenwaith's full-sized avatar

Chad Armstrong edenwaith

View GitHub Profile
@edenwaith
edenwaith / filesize.m
Last active February 22, 2023 09:45
Multiple ways to calculate the size of a file's resource fork
/*
* filesize.m
* Description: Multiple ways to calculate the size of a file's resource fork
* Author: Chad Armstrong
* Date: 14 April 2018 (Updated 28 October 2022)
* To compile: gcc -w -framework Cocoa filesize.m -o filesize
* To run: ./filesize path/to/file
*/
/* References:
@edenwaith
edenwaith / batch_compress_tiffs
Created September 13, 2017 22:57
Compress a bunch of TIFF images using the LZW compression method and sips from the Mac command line
ls *.tif | xargs sips -s format tiff -s formatOptions lzw
@edenwaith
edenwaith / CountOpenChromeTabs.scpt
Last active May 29, 2022 07:56
AppleScript: Count the number of open tabs in Google Chrome
-- CountOpenChromeTabs.scpt
-- Author: Chad Armstrong
-- Date: 30 August 2019
-- Description: Count the number of open tabs in Google Chrome
-- To run from CLI: osascript CountOpenChromeTabs.scpt
-- To create an alias command:
-- In ~/.bash_profile, add the line: alias counttabs='osascript ~/Projects/Scripts/CountOpenChromeTabs.scpt'
-- Refresh the bash shell environment: source ~/.bash_profile
tell application "Google Chrome"
@edenwaith
edenwaith / Quest For Glory 5 Mac OS 9 Installer Script.scpt
Last active May 3, 2022 03:19
AppleScript to install Quest For Glory V on Mac OS 9
-- QFG5 Mac OS 9 Installer
-- Author: Chad Armstrong (chad@edenwaith.com)
-- Version History:
-- • Version 1.1 (April - May 2022)
-- • Version 1.0 (8 October 2001)
tell application "Finder"
set startupDisk to (name of startup disk)
set applicationsFolder to startupDisk & ":Applications:"
@edenwaith
edenwaith / rle.swift
Last active January 31, 2022 19:23
Swift example of encoding a string using Run Length Encoding
#!/usr/bin/swift
import Foundation
/*
* rle.swift
*
* Author: Chad Armstrong
* Date: 21 July 2018
* Description: Example of encoding a string using Run Length Encoding
* Example: The string aabbbaaaac will be encoded as 2a3b4a1c
@edenwaith
edenwaith / make-android-icons.sh
Last active December 30, 2021 11:59
Take an image and output to various Android resolutions (ldpi - xxxhdpi)
#!/bin/sh
# make-android-icons.sh
# Author: Chad Armstrong
# Date: 11 December 2020
# Description: Take an image and output to various Android resolutions (ldpi - xxxhdpi)
# This script runs under macOS and requires ImageMagick to be installed.
# Need ImageMagick first
@edenwaith
edenwaith / CreateAccessibilityInspectorAlias.scpt
Created December 9, 2021 05:39
AppleScript to create an alias in the Applications folder which points to the Accessibility Inspector.app contained within Xcode.
-- File: CreateAccessibilityInspectorAlias.scpt
-- Description: Create an alias in the Applications folder which points to the
-- Accessibility Inspector.app contained within Xcode.
-- Author: Chad Armstrong (chad@edenwaith.com)
-- Date: 8 December 2021
tell application "Finder"
set destinationFolder to "Macintosh HD:Applications"
set sourceApplication to "Macintosh HD:Applications:Xcode.app:Contents:Applications:Accessibility Inspector.app"
make new alias file at destinationFolder to sourceApplication
end tell
@edenwaith
edenwaith / freesize.m
Last active December 2, 2021 21:43
A variety of methods to calculate the free space on a Mac volume
/*
* freesize.m
* Description: Multiple ways to calculate the free space on the root volume
* Blog post: http://www.edenwaith.com/blog/index.php?p=67
* Author: Chad Armstrong
* Date: 6 - 10 May 2017, 25 August 2021
* To compile: gcc -framework Foundation freesize.m -o freesize
* To run: ./freesize
*/
@edenwaith
edenwaith / xcode-build-bump.sh
Last active March 5, 2021 13:02 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@edenwaith
edenwaith / FindAGIGameID.c
Last active January 9, 2021 17:54
Check to see if an AGI Sierra game is either version 2 or 3.
/*
* FindAGIGameID.c
* Description: Check to see if an AGI Sierra game is either version 2 or 3.
* Author: Chad Armstrong
* Date: 29 April 2020
* To compile: gcc -Wall -o FindAGIGameID FindAGIGameID.c
* To run: ./FindAGIGameID
*
* References:
* - https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/glob.3.html