Skip to content

Instantly share code, notes, and snippets.


Jerry Krinock jerrykrinock

View GitHub Profile
jerrykrinock / gist:82bf441bdd1ab78cbe769d8158b4df0f
Created Jan 26, 2021
How to replace deprecated CFURLCreateStringByAddingPercentEscapes() with -[NSString stringByAddingPercentEncodingWithAllowedCharacters:]
View gist:82bf441bdd1ab78cbe769d8158b4df0f
Question: Which NSCharacterSet should I pass to -[NSString stringByAddingPercentEncodingWithAllowedCharacters:]
so that it works exactly like the deprecated CFURLCreateStringByAddingPercentEscapes() did?
Answer: Either URLFragmentAllowedCharacterSet or URLQueryAllowedCharacterSet
That answer comes from the following program output, which is the result of running
the code below it.
Frag Host Pswd Path Qery User CFnd
jerrykrinock /
Last active Aug 22, 2017
Script which packages browser extensions for Firefox, Opera and Chrome
packExtensionForBrowser () {
echo "#"
echo "##### Building $productName as $type for $browser #####"
cd $sourceDir
# Remove .DS_Store file, if any
rm -f $productName/BrowserCommon.DS*
# Make a temporary directory path which we shall use for building
jerrykrinock / JerryLib.scptd
Last active Jun 3, 2021
My personal utility library of AppleScript handlers, and some one-liners
View JerryLib.scptd
-- To load this library, see section titled "-- Using a handler in a .scpt library" at the top of One_Liners.scpt.
on testJerryLib()
return 0
end testJerryLib
(* The bad thing about this handler is that it always asks the user for admin credentials whether or not they are actually needed to answer the question on the given path.
Obviously, you can remove the 'with adminstrator privileges'. Unfortunately, this will cause the method to return 'false' if an existing path cannot be probed because of bad permissions. I can't see any way to differentiate between inadequate permissions and nonexisting file because they both set errNumber = 54.
The -e checks for directories or files. To require that the given path be a directory, use -d. For file, use -f. For more variations, see: *)
jerrykrinock / SSYTroubleZipper
Last active Jul 4, 2018
Demonstrates a boatload of AppleScript techniques, primarily focused on gathering data from a user's Mac account for troubleshooting.
View SSYTroubleZipper
(* Actually running this script requires that several other tools be included into
the script's package. The entire package, which should include the latest version of
this script, may be downloaded from here: *)
property scriptVersion : "0255 published 2014-12-04"
property companyUTI : "com.sheepsystems"
property ourProcessNames : {"Bookdog", "Bookwatchdog", "BookMacster", "Markster", "Smarky", "Synkmark", "Sheep-Sys-Worker", "Sheep-Sys-Quatch", "Sheep-Sys-Thomas", "Sheep-Sys-UrlHandler", "FileAliasWorker"}
-- The above are all acted upon in 'try' blocks, so it's OK if some don't exist in certain context(s).
property companyName : "Sheep Systems"
jerrykrinock / Finale Save as PDF.applescript
Last active Sep 7, 2020
Saves the current Finale music score as a PDF file, named and located, overwriting old PDF, with one keystroke
View Finale Save as PDF.applescript
-- Version: Substantially rewrote on 2020 09 06 to use Graphics > Export Pages instead of
File > Print > Save as PDF. Also now works with Finale 26 and macOS 10.11 Big Sur (Beta 6).
Have not tested with earlier versions.
-- Begin Parameters which you should edit
-- Set saveDirPath to the path to the directory you always save your PDF outputs saved to.
-- Possibly starting with OS X 10.10.2, the "~" in the following no longer expands to your home folder. Path must start with /Users/<yourShortName>
jerrykrinock /
Last active Aug 29, 2015
In a YaBB Forum (, removes deadbeat members created by spamming attempts
This script takes one parameter, the path/to/Members subdirectory of a YaBB 2.4 directory. It deletes files of any members who have registered more than 72 hours ago, and have never posted any posts that have not been removed. Presumably such members were registered by spammers' robots.
It also modifies the 'memberlist.txt' and 'memberinfo.txt' files in there appropriately, deleting the culled members. It does not touch the 'memberlist.inactive', which appears to be records of "new members who have not yet registered".
This script has been tested in Mac OS X and should work in any Unix system.
jerrykrinock /
Last active Aug 25, 2018
Signs (codesign) with Developer ID, and zips an OS X app, recursively, from the inside out. When I wrote this script, Apple's `codesign` tool did not do the recursion and therefore did not work. Maybe today it does. Try Apple's tool before using this. This is handy for sending AppleScripts (in the form of OS X apps) to individual users who need …
use strict ;
use IPC::Run ;
use File::Basename ;
use File::Util ;
# Sometimes this is necessary for modules in this directory to be found at compile time when running on my Mac:
use lib '/Users/jk/Documents/Programming/Scripts' ;
jerrykrinock / CheckAndClearXattrs.plist
Last active Jan 6, 2019 checks a given target directory for extended attributes. If any extended attributes are found, it removes them and displays a dialog. Otherwise, it just logs to the system console. You provide the target directory's path as the first and only argument to this script. I launchd it once an hour, using the file, CheckBuildDir…
View CheckAndClearXattrs.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
jerrykrinock /
Last active Jul 4, 2018
This script is for shipping OS X apps outside the Mac App Store. It will run you through a comprehensive quality-control checklist, supports alpha, beta and production channels, builds the product (or re-ships a previous build to a different channel), codesigns all components with Developer ID per Apple TN2206, builds the Help Book from Markdown…
This script will
Force you through a comprehensive quality-control checklist
Run Deploymate
Get the latest version number by reading it from product's Info.plist
jerrykrinock / StarkEditor.h
Created Dec 4, 2013
This code is in response to a question on Stack Overflow wherein Jan Doggen asked if I could share my code. Probably won't be very helpful, but I'm all for sharing code, even if it happens to be Objective-C :) The general subject is: A general method for editing trees - methods which will add, remove, copy, move etc. nodes in the tree. Regarding…
View StarkEditor.h
#import <Cocoa/Cocoa.h>
#import "BkmxAppDel.h"
#import "BkmxGlobals.h"
enum BkmxParentingAction_enum
BkmxParentingActionNone, // 0
BkmxParentingAdd, // 1
BkmxParentingRemove, // 2
BkmxParentingCopy, // 3