Skip to content

Instantly share code, notes, and snippets.

View edenwaith's full-sized avatar

Chad Armstrong edenwaith

View GitHub Profile
@edenwaith
edenwaith / agi-logic.plist
Created May 21, 2019 01:25
BBEdit Codeless Language Module for Sierra On-Line's AGI LOGIC
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BBEditDocumentType</key>
<string>CodelessLanguageModule</string>
<key>BBLMColorsSyntax</key>
<true/>
<key>BBLMIsCaseSensitive</key>
<true/>
@edenwaith
edenwaith / lcd_exp.ino
Created November 27, 2018 01:25
Take input from the keyboard and print it to a 16x2 LCD display.
#include <LiquidCrystal.h>
// LiquidCrystal display with:
// rs on pin 12
// rw on pin 11
// enable on pin 10
// d4-7 on pins 5 - 2
// LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
// LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
@edenwaith
edenwaith / clear_cal_cache.sh
Last active March 1, 2024 07:54
Clear the cached calendars for macOS Calendar
#!/bin/sh
# Author: Chad Armstrong
# Date: 29 August 2018
# Description: Clear the cached calendars for macOS Calendar
# References:
# https://michaelkummer.com/technology/fix-calendar-cant-save-event-x-exchange/
# https://wilkinsit.ca/mac-osx/clear-calendar-cache-mac-os/
# https://stackoverflow.com/a/3510850/955122
@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 / export_words_tok.m
Last active July 3, 2018 03:50
Reverse engineer the WORDS.TOK file from an AGI Sierra game.
/*
* export_words_tok.m
*
* Description: Reverse engineer the WORDS.TOK file from an AGI Sierra game.
* The results are saved into two files: words.txt and words.json
* Author: Chad Armstrong ([email protected])
* Date: 25-28 June 2018
* To compile: gcc -w -framework Foundation export_words_tok.m -o export_words
*
* Resources:
@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 / Force Empty Trash.scpt
Last active May 21, 2019 07:58
Force empty the Mac Trash using an AppleScript
-- Source: http://hints.macworld.com/article.php?story=2002041207430253
display dialog "Force Empty Trash?" buttons ¬
{"Cancel", "Trash"} default button "Trash" with icon note
set the user_choice to the button returned of the result
if the user_choice is "Trash" then
display dialog "Are you sure?" buttons {"No", "Yes"} ¬
default button "No" with icon note
set the user_choice to the button returned of the result
@edenwaith
edenwaith / checkFilePermissions.m
Last active April 9, 2018 02:21
Check if a file can be deleted on a Mac
/*
* checkFilePermissions.m
* Description: A collection of methods which checks if a given file can be deleted
* and checks other permissions and properties.
* Author: Chad Armstrong
* Date: 1 December 2017
* To compile: gcc -w -framework Foundation -framework AppKit checkFilePermissions.m -o checkFilePermissions
*/
#import <Foundation/Foundation.h>
@edenwaith
edenwaith / DiskManagement.h
Last active October 10, 2019 21:49
Get the available free space on the root drive using the method volumeFreeSpaceForDisk from the private framework DiskManagement
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#pragma mark Blocks
typedef void (^CDUnknownBlockType)(void); // return type and parameters are unknown
@edenwaith
edenwaith / lock-screen.scpt
Last active July 7, 2019 11:55
Lock the screen in macOS High Sierra using an AppleScript
tell application "System Events" to tell process "Finder"
-- Menu bar item 1 is the Apple menu
click menu item "Lock Screen" of menu 1 of menu bar item 1 of menu bar 1
end tell