This file contains hidden or 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
#!/usr/bin/env ruby | |
user_id = `id -u`.chomp | |
secret_login_items_path = "/var/db/com.apple.xpc.launchd/loginitems.#{user_id}.plist" | |
puts File.read(secret_login_items_path) |
This file contains hidden or 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
#!/usr/bin/ruby | |
# Tested on an iOS 8 iPhone backup done via iTunes | |
# point this to the desired backup found in ~/Library/Application Support/MobileSync/Backup/ | |
backup_path = "/Users/nathan/Desktop/PhoneBackup/" | |
voicemails_path = "/Users/nathan/Desktop/Voicemail/" | |
Dir.foreach(backup_path) do |item| |
This file contains hidden or 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
extension Array { | |
// Similar to Lisp's map function that allows returning nil in the transform to omit the item from the resulting array. | |
func mapAndFilter<U>(transform: (T) -> U?) -> U[] { | |
var results = U[]() | |
for item in self { | |
if let transformedItem = transform(item) { | |
results.append(transformedItem) | |
} | |
} | |
return results |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'FileUtils' | |
require 'date' | |
def create_dir_if_necessary(path) | |
Dir.mkdir(path) unless File.directory?(path) | |
end | |
desktops_path = File.expand_path("~/Dropbox/Documents/Desktops") |