This file contains 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
func trim(str: String) ->String { | |
return str.stringByTrimmingCharactersInSet(NSCharacterSet.newlineCharacterSet()) | |
} | |
func input() -> String? { | |
var keyboard = NSFileHandle.fileHandleWithStandardInput() | |
var inputData = keyboard.availableData | |
var result: String? = nil | |
if inputData.length != 0 { | |
result = NSString(data: inputData, encoding:NSUTF8StringEncoding) as? String |
This file contains 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
import Quartz | |
import CoreFoundation as CF | |
import os, sys | |
filename = os.path.abspath(sys.argv[1]) | |
url = CF.CFURLCreateFromFileSystemRepresentation(None, filename, len(filename), False) | |
img_src = Quartz.ImageIO.CGImageSourceCreateWithURL(url, {}) | |
properties = Quartz.ImageIO.CGImageSourceCopyPropertiesAtIndex(img_src, 0, None) | |
exif = properties[Quartz.ImageIO.kCGImagePropertyExifDictionary] |