Skip to content

Instantly share code, notes, and snippets.

View edenwaith's full-sized avatar

Chad Armstrong edenwaith

View GitHub Profile
@edenwaith
edenwaith / erase_freespace.sh
Last active June 9, 2017 19:15
Shell script to erase free space on a Mac (Currently a work in progress)
#!/bin/sh
# Erase freespace from the command line: diskutil secureErase freespace [level] [device]
if [ "$#" -lt 1 ]; then
echo "$0: too few arguments"
echo "Usage: $0 path/to/disk" >&2 # echo error to stderr
exit 1
fi
import objc, os
from Foundation import *
from AppKit import *
ACScriptSuperMenuTitle = None
ACScriptMenuTitle = "Compress with TinyPNG"
ACShortcutKey = 'i'
ACShortcutMask = "command control"
ACIsAction = True
var s_ajaxListener = new Object();
s_ajaxListener.tempOpen = XMLHttpRequest.prototype.open;
s_ajaxListener.tempSend = XMLHttpRequest.prototype.send;
s_ajaxListener.callback = function () {
window.location='mpAjaxHandler://' + this.url;
};
XMLHttpRequest.prototype.open = function(a,b) {
if (!a) var a='';
if (!b) var b='';
@edenwaith
edenwaith / git-branch-delete
Last active September 20, 2017 19:13
git-branch-delete Delete both a local and remote git branch with one command.Place this file in your /usr/local/bin/ directory.Usage:git branch-delete <name_of_branch>
#!/usr/bin/env ruby
#
# git-branch-delete
#
# Deletes a branch both locally and remotely in the origin.
#
###############################################################################
# Usage
###############################################################################
@edenwaith
edenwaith / erasefreespace.m
Created October 6, 2017 03:43
Example code for erasing free disk space by calling diskutil from an NSTask
/*
* erasefreespace.m
* Description: Parse a string for the percentage of freespace erased
* Author: Chad Armstrong
* Date: 3 October 2017
* To compile: gcc -framework Foundation erasefreespace.m -o erasefreespace
*/
#import <Foundation/Foundation.h>
@edenwaith
edenwaith / git-branch-batch-rename
Created February 9, 2015 17:27
Rename multiple git branches from the command line
git branch | grep defects | awk '{original=$1; sub("defects","old-defects"); print original, $1}' | xargs -n 2 git branch -m
@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 / 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 (chad@edenwaith.com)
* Date: 25-28 June 2018
* To compile: gcc -w -framework Foundation export_words_tok.m -o export_words
*
* Resources:
@edenwaith
edenwaith / tss.sh
Last active October 1, 2018 04:15
Command line bash script to take a screenshot of the Xcode Simulator
#!/bin/sh
# TSS = Take Simulator Screenshot
# Script workaround for the crash in Xcode 8 Simulator crashing when
# trying to save a screenshot in El Capitan
# Version: 1.2 (3 February 2017) - Add screenshot to clipboard
# Version: 1.1 (31 January 2017) - Play screenshot file
# Version: 1.0 (Early January 2017) - Initial version
# Change to the Desktop, take the screenshot, then move back to the original directory
@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);