git init
or
| 1. Open Terminal | |
| 2. cd to your Xcode project | |
| 3. Execute the following when inside your target project: | |
| find . -name "*.swift" -print0 | xargs -0 wc -l |
| #!/usr/bin/env python | |
| # dump the contents of an atmel AT45DB041B flash part to 'data.bin' | |
| # usage: ./dump_AT45DB041B.py /dev/ttyUSB0 | |
| # tested w/ https://github.com/audiohacked/pyBusPirate ac19e00b53, Bus Pirate Hardware labelled v3.6, Firmware: "Bus Pirate v3b, Firmware v5.10 (r559), Bootloader v4.4" | |
| # bugs: slow. as in... dozens of hours :/ |
| """ | |
| A replacement for the django-compressor `compress` management command that renders all | |
| templates with each `LANGUAGE_CODE` available in your `settings.LANGUAGES`. | |
| Useful for making static-i18n work with django-compressor, among other things. | |
| """ | |
| import os | |
| from os.path import join | |
| import json |
| import Foundation | |
| extension NSData { | |
| func MD5() -> NSString { | |
| let digestLength = Int(CC_MD5_DIGEST_LENGTH) | |
| let md5Buffer = UnsafeMutablePointer<CUnsignedChar>.alloc(digestLength) | |
| CC_MD5(bytes, CC_LONG(length), md5Buffer) | |
| var output = NSMutableString(capacity: Int(CC_MD5_DIGEST_LENGTH * 2)) | |
| for i in 0..<digestLength { |
| extension String { | |
| func md5() -> String! { | |
| let str = self.cStringUsingEncoding(NSUTF8StringEncoding) | |
| let strLen = CUnsignedInt(self.lengthOfBytesUsingEncoding(NSUTF8StringEncoding)) | |
| let digestLen = Int(CC_MD5_DIGEST_LENGTH) | |
| let result = UnsafeMutablePointer<CUnsignedChar>.alloc(digestLen) | |
| CC_MD5(str!, strLen, result) | |
| var hash = NSMutableString() |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/bin/sh | |
| # Enable and disable HDMI output on the Raspberry Pi | |
| is_off () | |
| { | |
| tvservice -s | grep "TV is off" >/dev/null | |
| } | |
| case $1 in |
| mail: { | |
| transport: 'SMTP', | |
| host: 'ssl://email-smtp.us-east-1.amazonaws.com', | |
| options: { | |
| port: 465, | |
| service: 'SES', | |
| auth: { | |
| user: 'YOUR-SES-ACCESS-KEY-ID', | |
| pass: 'YOUR-SES-SECRET-ACCESS-KEY' | |
| } |