Skip to content

Instantly share code, notes, and snippets.

View jerrykrinock's full-sized avatar

Jerry Krinock jerrykrinock

View GitHub Profile
@jerrykrinock
jerrykrinock / gitcreate.sh
Last active July 12, 2023 17:38 — forked from robwierzbowski/gitcreate.sh
This script creates a new repo on github.com, then pushes to it the local repo from the current directory. Fork of https://gist.github.com/robwierzbowski/5430952/. Some of Rob's lines just didn't work for me, and I made it more verbose while fixing. UPDATE 2017-06-30. No longer needed by Xcode users because this capability is built into Xcode 9 :)
#!/bin/bash
# This script create a new repo on github.com, then pushes the local repo from the current directory to the new remote.
# It is a fork of https://gist.github.com/robwierzbowski/5430952/. Some of Rob's lines just didn't work for me, and to fix them I needed to make it more verbose so that a mere electrical engineer could understand it.
# This script gets a username from .gitconfig. If it indicates that your default username is an empty string, you can set it with
# git config --add github.user YOUR_GIT_USERNAME
# Gather constant vars
@jerrykrinock
jerrykrinock / How-to-Symbolize-MacOSX-Crash-Dump
Created September 25, 2013 15:26
How to symbolize a crash dump in Mac OS X, given a crash dump or exception log. Includes some steps and tips I've collected that are missing in Apple's TN2123. One time I tried this using lldb instead of gdb but it didn't work.
********************************************************
*** STEPS TO SYMBOLIZE A CRASH DUMP OR EXCEPTION LOG ***
********************************************************
1) Move/copy both the crashing .app and the relevant.dSYM files into the same directory.
2) If the crash was in a framework, dynamic library, or bundle, you have position-independent code and must work out the *slide*. Otherwise, skip up to step 9 and use slide=0.
3a) If you have a crash dump, look in the *Binary Images* part of the crash log and find the framework, dynamic libray or bundle in which the crash occurred. Read the first column of the output. This is the address at which the __TEXT segment was loaded. We call it the *Actual Load Address* and denote it as *A*.
@jerrykrinock
jerrykrinock / StarkEditor.h
Created December 4, 2013 19:56
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…
#import <Cocoa/Cocoa.h>
#import "BkmxAppDel.h"
#import "BkmxGlobals.h"
enum BkmxParentingAction_enum
{
BkmxParentingActionNone, // 0
BkmxParentingAdd, // 1
BkmxParentingRemove, // 2
BkmxParentingCopy, // 3
@jerrykrinock
jerrykrinock / SSYShipProduct.pl
Last active July 4, 2018 21:49
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…
#!/usr/bin/perl
=com
PURPOSE
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
jerrykrinock / CheckAndClearXattrs.plist
Last active January 6, 2019 00:20
CheckAndClearXattrs.sh 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…
<?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>Label</key>
<string>CheckBuildDirXattrs</string>
<key>ProgramArguments</key>
<array>
<string>/Users/jk/bin/CheckAndClearXattrs.sh</string>
<string>/Users/jk/Documents/Programming/Builds</string>
@jerrykrinock
jerrykrinock / codesigndeveloperid.pl
Last active August 25, 2018 19:04
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 …
#!/usr/bin/perl
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
jerrykrinock / YaBBCullDeadbeatMembers.pl
Last active August 29, 2015 14:04
In a YaBB Forum (http://www.yabbforum.com), removes deadbeat members created by spamming attempts
#!/usr/bin/perl
=com
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
jerrykrinock / Finale Save as PDF.applescript
Last active September 7, 2020 03:37
Saves the current Finale music score as a PDF file, named and located, overwriting old PDF, with one keystroke
-- 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
jerrykrinock / SSYTroubleZipper
Last active July 4, 2018 21:33
Demonstrates a boatload of AppleScript techniques, primarily focused on gathering data from a user's Mac account for troubleshooting.
(* 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:
http://sheepsystems.com/files/SSYTroubleZipper.zip *)
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
jerrykrinock / JerryLib.scptd
Last active March 21, 2023 11:52
My personal utility library of AppleScript handlers, and some one-liners
-- 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:
http://www.cyberciti.biz/tips/find-out-if-file-exists-with-conditional-expressions.html *)