Skip to content

Instantly share code, notes, and snippets.

View edenwaith's full-sized avatar

Chad Armstrong edenwaith

View GitHub Profile
@edenwaith
edenwaith / entitlements.plist
Created September 22, 2024 16:54
Entitlements plist used when code signing a Mac game to allow third party libraries (such as for Steam) to communicate properly
<?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>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
</dict>
</plist>
@edenwaith
edenwaith / github.css
Created July 23, 2024 16:50
GitHub-style CSS file for BBEdit's Preview CSS to preview Markdown files
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@edenwaith
edenwaith / udemy.sh
Last active May 5, 2024 00:42
Folder Action script to unarchive and move a zip file downloaded from a specific website
#!/bin/zsh
# Script for an Automator Folder Action to check if a downloaded zip file came from a particular website
# (in this case, from https://gale.udemy.com), then unzip the contents to a specific location and then
# move the zip file also to that same destination.
# Set this as a Run Shell Script in Automator, and set the "Pass input:" option "as arguments"
for f in "$@"; do
# Example response from the mdls call
# kMDItemWhereFroms = (
@edenwaith
edenwaith / pict_to_png_batch_convert.txt
Last active April 8, 2024 03:19
Convert Mac OS 9 PICT files to PNG from the Mac Terminal
for i in *; do sips -s format png $i --out $i.png;done
@edenwaith
edenwaith / CustomRoundedImageView.swift
Last active March 22, 2024 17:53
Example in SwiftUI to demonstrate creating an Image with rounded corners with different radii
//
// CustomRoundedImageView.swift
//
// Created by Chad Armstrong on 3/2/24.
// Example in SwiftUI to demonstrate creating an Image which is clipped with a custom shape and different corner radii
// An alternative to this method in SwiftUI is to clip a shape using a .rect with custom corner radii via RectangleCornerRadii
import SwiftUI
struct CustomRoundedRectShape: Shape {
@edenwaith
edenwaith / SendPasteboardToSimulator.scpt
Created January 2, 2024 18:02
Applescript to copy text from the Mac's clipboard to older iOS Simulators
-- Any iOS Simulator which isn't the most current version has issues with working with the
-- system's clipboard, which makes things difficult if one wants to copy a lengthy username
-- into a field. This script is a workaround which will get the text from the system's
-- clipboard and then paste that text into a field in the active iOS Simulator.
-- Reference: https://stackoverflow.com/questions/15188852/copy-paste-text-into-ios-simulator
tell application "System Events"
set theText to get the clipboard as text
delay 1
repeat with aCharacter in characters of theText
keystroke aCharacter
@edenwaith
edenwaith / ordered_dithering.c
Created September 27, 2023 02:53
Generates a dithering matrix as a 2D array
/* ordered_dithering.c
* Code by Stephen Hawley from page 713 from the book Graphics Gems
* Generates a dithering matrix from the command line arguments.
* The first argument, size, determines the dimensions of the
* matrix, 2^size by 2^size
* The optional range argument is the range of values to be
* dithered over. By default, it is (2^size)^2, or simply the
* total number of elements in the matrix.
* The final output is suitable for inclusion in a C program.
* Date: 3 September 2023
@edenwaith
edenwaith / ordered_dither.m
Last active October 11, 2023 02:46
Convert an image to a black and white image and use ordered dithering
/*
* ordered_dither.m
*
* Description: Convert an image to a black and white image and use ordered dithering
* Author: Chad Armstrong ([email protected])
* Date: 4-5 September 2023
* To compile: gcc -w -framework Foundation -framework AppKit -framework QuartzCore ordered_dither.m -o ordered_dither
* To run: ./ordered_dither path/to/image.png [dither level]
*
*/
@edenwaith
edenwaith / Quest For Glory 5 Mac OS 9 Installer Script.scpt
Last active August 3, 2024 09:59
AppleScript to install Quest For Glory V on Mac OS 9
-- QFG5 Mac OS 9 Installer
-- Author: Chad Armstrong ([email protected])
-- 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 / 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 ([email protected])
-- 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