This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in *; do sips -s format png $i --out $i.png;done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- File: MarkUnreadEmails.scpt | |
-- Description: Go through the mailboxes in Outlook and mark unread messages as read | |
-- Author: Chad Armstrong | |
-- Date: 22 November 2019 | |
tell application "Microsoft Outlook" | |
set myInbox to folder "Inbox" of default account | |
set github to folder "GitHub" of myInbox | |
set other to folder "Other" of myInbox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- CountOpenSafariTabs.scpt | |
-- Author: Chad Armstrong | |
-- Date: 13 May 2016 | |
-- Description: Count the number of open tabs in Safari | |
-- To run from CLI: osascript CountOpenSafariTabs.scpt | |
tell application "Safari" | |
--Variables | |
set winlist to every window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* ordered_dither.m | |
* | |
* Description: Convert an image to a black and white image and use ordered dithering | |
* Author: Chad Armstrong (chad@edenwaith.com) | |
* 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] | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func isModal() -> Bool { | |
return self.presentingViewController?.presentedViewController == self | |
|| (self.navigationController != nil && self.navigationController?.presentingViewController?.presentedViewController == self.navigationController) | |
|| self.tabBarController?.presentingViewController is UITabBarController | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Maintenance script run on a weekly basis (controlled by launchd and the | |
# associated plist file located at ~/Library/LaunchAgents/local.cleanupdesktop.plist | |
# | |
# Move all screenshot files on the Desktop into the folder Screenshots | |
# Check for the existence of the Screenshots folder. Create it if it doesn't exist. | |
if [ ! -d ~/Desktop/Screenshots ]; then | |
mkdir ~/Desktop/Screenshots |
NewerOlder