Skip to content

Instantly share code, notes, and snippets.

@darkfall
darkfall / gist:13001c901edf0dc9fb85
Last active January 24, 2021 10:03
get objc subclasses via private runtime info
#include <objc/objc-runtime.h>
// from objc_runtime_new.h with some simplifications
#if __LP64__
typedef uint32_t mask_t;
#define FAST_DATA_MASK 0x00007ffffffffff8UL
#else
typedef uint64_t mask_t;
#define FAST_DATA_MASK 0xfffffffcUL
@jjgod
jjgod / ocf-cc.py
Created January 27, 2013 12:23
Convert files in Open Container Format (.epub) from Traditional Chinese to Simplified Chinese.
#!/usr/bin/env python
# Convert files in Open Container Format from Traditional Chinese
# to Simplified Chinese.
import sys, os, zipfile, re, codecs, subprocess
from xml.dom import minidom
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
debug = True
@bewebste
bewebste / backup_growl.rb
Created May 7, 2012 18:47
Script to display Time Machine progress messages as Growl notifications
#!/usr/bin/ruby
#Just run this script in a terminal window, leaving the window open in the
#background so it can continue to process messages.
IO.popen("syslog -F \'$(Sender): $Message\' -w -k Sender com.apple.backupd") { |syslogIO|
while (inputString = syslogIO.gets) do
escapedString = inputString.gsub("'", "\\'")
`/usr/local/bin/growlnotify -a 'Time Machine' -m '#{escapedString}'`
end
}