Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| @interface DownloadOperation : NSOperation | |
| { | |
| NSURLRequest *request; | |
| NSURLConnection *connection; | |
| NSMutableData *receivedData; | |
| } | |
| @property(readonly) BOOL isExecuting; | |
| @property(readonly) BOOL isFinished; |
| #!/usr/bin/env python | |
| """Compare two aligned images of the same size. | |
| Usage: python compare.py first-image second-image | |
| """ | |
| import sys | |
| from scipy.misc import imread | |
| from scipy.linalg import norm |
| def format_time(secs): | |
| return "%d:%02d" % (secs / 60, secs % 60) | |
| def invert(arr): | |
| """ | |
| Make a dictionary that with the array elements as keys and | |
| their positions positions as values. | |
| >>> invert([3, 1, 3, 6]) |
| #import <UIKit/UIKit.h> | |
| #import <ImageIO/ImageIO.h> | |
| #import <MobileCoreServices/MobileCoreServices.h> | |
| - (void)exportAnimatedGif | |
| { | |
| UIImage *shacho = [UIImage imageNamed:@"shacho.png"]; | |
| UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"]; | |
| NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"]; |
| -- from http://www.tuaw.com/2011/03/14/use-applescript-to-open-current-safari-url-in-google-chrome/ | |
| -- install FastScripts http://www.red-sweater.com/fastscripts/ and place this AppleScript in the Scripts applications folder for Google Chrome. | |
| -- For me that was ~/Library/Scripts/Applications/Safari | |
| -- You can then assign it a keyboard shortcut. I went with Cmd-Shift-C | |
| property theURL : "" | |
| tell application "Safari" | |
| set theURL to URL of current tab of window 1 | |
| end tell | |
| tell application "Google Chrome" |
| @interface DownloadOperation : NSOperation | |
| { | |
| NSURLRequest *request; | |
| NSURLConnection *connection; | |
| NSMutableData *receivedData; | |
| } | |
| @property(readonly) BOOL isExecuting; | |
| @property(readonly) BOOL isFinished; |
| // For details, see http://mindsea.com/2012/12/18/downscaling-huge-alassets-without-fear-of-sigkill | |
| #import <AssetsLibrary/AssetsLibrary.h> | |
| #import <ImageIO/ImageIO.h> | |
| // Helper methods for thumbnailForAsset:maxPixelSize: | |
| static size_t getAssetBytesCallback(void *info, void *buffer, off_t position, size_t count) { | |
| ALAssetRepresentation *rep = (__bridge id)info; | |
| NSError *error = nil; |
| # Tell system when Xcode utilities live: | |
| sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer | |
| # Set "opendiff" as the default mergetool globally: | |
| git config --global merge.tool opendiff |
| // Taken from the commercial iOS PDF framework http://pspdfkit.com. | |
| // Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
| // Licensed under MIT (http://opensource.org/licenses/MIT) | |
| // | |
| // You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it. | |
| // PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit. | |
| #import <objc/runtime.h> | |
| #import <objc/message.h> |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000