Skip to content

Instantly share code, notes, and snippets.

View brutella's full-sized avatar
🏠
Working from home

Matthias brutella

🏠
Working from home
View GitHub Profile
@brutella
brutella / gist:2031d51f012d12911f42
Created October 4, 2014 08:10
Inter-app communication proposal

I'm working on a system, which provides sensor data over a specific protocol to clients. There are

  • multiple sensors (S)

  • one bridge (B)

  • multiple clients (C)

    S <-> B <-> C

@brutella
brutella / generate-icons.sh
Created November 5, 2014 17:11
Create iOS 8 app icons
#! /bin/sh
# Usage
# ./generate-icons.sh ./AppIcon.png
FILE=$1
DIR=$(dirname $FILE)
convert -resize '120x120' ${FILE} ${DIR}/iPhone@2x.png
convert -resize '180x180' ${FILE} ${DIR}/iPhone@3x.png
convert -resize '58x58' ${FILE} ${DIR}/iPad_Settings@2x.png
@brutella
brutella / pair-setup
Created March 13, 2015 15:17
Xcode 6.3 Accessory Simulator Pair Setup Log
Mar 13 16:16:05 macbookpro.local HomeKit Accessory Simulator[80849] <Debug>: [HAKIPTransport.m:226 0011c710] POST Request
Mar 13 16:16:05 macbookpro.local HomeKit Accessory Simulator[80849] <Info>: [HAKPairSetupCharacteristic.m:82 00128840] Connection attempted to pair setup a paired transport: <HAKIPConnection 0x6100000bd400 transport = <HAKIPTransport 0x60800011c710 Name: Light, Identifier: <HAKIdentifier 0x608000208c10> D0:B0:1E:A8:20:DB, Password: 740-51-881, Started: YES, Accessories: (
"<HAKAccessory: 0x61000027be00>"
)>, encrypted = NO host = <NSHost 0x61000022d360> localhost ((
localhost,
"127.0.0.1"
) (
"127.0.0.1"
))>
Mar 13 16:16:05 macbookpro.local HomeKit Accessory Simulator[80849] <Warning>: [HAKIPTransport.m:602 0011c710] Failed to handle pairing request with status code: -1
@brutella
brutella / gist:3952127
Created October 25, 2012 11:38
XTrail Crash iPhone 5
Oct 25 13:17:57 Xtrail[301] <Warning>: -[_PFUbiquityRecordImportOperation main](456): CoreData: Ubiquity: Error saving managed object context changes for transaction log: <PFUbiquityTransactionLog: 0x1ea430f0>
transactionLogLocation: <PFUbiquityLocation: 0x1d59dc20>: /private/var/mobile/Library/Mobile Documents/74BP53VAWB~com~sophiestication~Xtrail/transaction_logs_v1/mobile.0B710C8F-A005-52BD-A258-6709C30AE01E/com.sophiestication.Xtrail.1/TlKPtvzYaLWeun_PDF5dWDToE0X2Mt45xlFG6t2ThDQ=/BB38D415-9084-461E-AF7B-2E939560CB17.1.cdt
transactionNumber: 3
Error: Error Domain=NSCocoaErrorDomain Code=1570 "The operation couldn’t be completed. (Cocoa error 1570.)" UserInfo=0x1d584e90 {NSValidationErrorObject=<NSManagedObject: 0x1e870ad0> (entity: Sharing; id: 0x1e8601f0 <x-coredata://6A363E96-A77C-4614-B99E-D2A3ACCA78D0/Sharing/p3081> ; data: {
expirationDate = "2012-07-19 18:46:06 +0000";
publishDate = "2012-06-19 18:46:06 +0000";
trail = nil;
url = "http://xtrail.me/aEsum6";
}), NSValidatio
@brutella
brutella / gist:4721414
Created February 6, 2013 09:33
Xtrail iCloud Problem iPhone 5 iOS 6.1
2013-02-06 09:22:57 +0000 Xtrail -[PFUbiquityTransactionLog loadPlistAtLocation:withError:](485): CoreData: Ubiquity: Error reading the log file at location: (null)
userInfo: (null), local error: Error Domain=NSCocoaErrorDomain Code=256 "The operation couldn’t be completed. (Cocoa error 256 - The item failed to download.)" UserInfo=0x2017ac80 {NSURL=file://localhost/private/var/mobile/Library/Mobile%20Documents/74BP53VAWB~com~sophiestication~Xtrail/transaction_logs_v1/mobile.A3FE0F4D-ACD4-5F2D-9081-BC13C73AE11D/com.sophiestication.Xtrail.1/TlKPtvzYaLWeun_PDF5dWDToE0X2Mt45xlFG6t2ThDQ=/35782D40-6704-4D9C-BEB4-68495A634CB5.1.cdt, NSUnderlyingError=0x2017ac20 "The operation couldn’t be completed. (UBErrorDomain error 0.)", NSDescription=The item failed to download.}
userInfo: {
NSDescription = "The item failed to download.";
NSURL = "file://localhost/private/var/mobile/Library/Mobile%20Documents/74BP53VAWB~com~sophiestication~Xtrail/transaction_logs_v1/mobile.A3FE0F4D-ACD4-5F2D-9081-BC13C73AE11D/com.soph
@brutella
brutella / gist:5465798
Created April 26, 2013 08:42
How to make ChatHeads to stay always in the screen center.
// Change the method _destinationPointForReleasePoint with this
- (CGPoint)_destinationPointForReleasePoint:(CGPoint)releasePoint
{
return CGPointMake(CGRectGetMidX(_window.bounds), CGRectGetMidY(_window.bounds));
}
NSExpression *minExpression = [NSExpression expressionForFunction:@"stddev:" arguments:@[ [NSExpression expressionForKeyPath:@"amount"] ]];
NSString *stdKey = @"std";
NSExpressionDescription *stdExpressionDescription = [[NSExpressionDescription alloc] init];
stdExpressionDescription.name = stdKey;
stdExpressionDescription.expression = minExpression;
stdExpressionDescription.expressionResultType = NSFloatAttributeType;
__block NSDictionary *dictionary = nil;
@brutella
brutella / reduce_fps
Last active April 18, 2016 12:42
Reduce frame rate of video to make screen recording from Quicktime compatible with App Store App Preview
# from http://stackoverflow.com/questions/11004137/re-sampling-h264-video-to-reduce-frame-rate-while-maintaining-high-image-quality
ffmpeg -y -i source.mov -r 30 -s 750x1334 -c:v libx264 -b:v 3M -strict -2 -movflags faststart destination.mov
@brutella
brutella / server.go
Created September 28, 2017 13:26
HTTP server which turns a HomeKit switch on and off
package main
import (
"github.com/brutella/hc"
"github.com/brutella/hc/accessory"
"github.com/brutella/hc/log"
"net/http"
)
func main() {
// Steps to get this running
// 1. Install Go: http://golang.org/doc/install
// 2. Setup Go workspace: http://golang.org/doc/code.html#Organization
// 3. Download dependencies in Terminal.app
// 3.1 Navigate to multiswitchtest.go
// 3.2 Execute `go get`
// 4. Run `go run multiswitchtest.go`
package main
import (