Skip to content

Instantly share code, notes, and snippets.

@thetzel
thetzel / main.go
Last active June 21, 2020 23:03
Exposure Notification Scanning on Raspberry Pi
package main
import (
"fmt"
"log"
"github.com/paypal/gatt"
"github.com/paypal/gatt/examples/option"
)
@thetzel
thetzel / coupons.tex
Created December 27, 2013 13:57
Serialized Coupons in LaTeX
\documentclass[10pt,parskip=full,a4paper]{article}
\pagestyle{empty}
\usepackage[top=2.5cm,left=1cm,right=1cm]{geometry}
\usepackage{csvtools}
\usepackage{lmodern}
\renewcommand*\familydefault{\sfdefault}
\usepackage[T1]{fontenc}
@thetzel
thetzel / main.m
Created July 3, 2013 20:44
Fork app in main.m between old codebase for iOS5/6 and new for iOS7+
NSUInteger DeviceSystemMajorVersion();
NSUInteger DeviceSystemMajorVersion() {
static NSUInteger _deviceSystemMajorVersion = -1;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_deviceSystemMajorVersion = [[[[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."] objectAtIndex:0] intValue];
});
return _deviceSystemMajorVersion;
}
@thetzel
thetzel / inapp.php
Created July 13, 2012 20:01
In App Purchase Verification PHP Code
<?php
function verifyPurchase($transactionid, $productid, $uuid, $sandbox=false) {
$body = @file_get_contents('php://input');
//encode receipt
$body = base64_encode($body);
$receipt = json_encode(array("receipt-data" => $body));
@thetzel
thetzel / audition2chapters.m
Created February 19, 2012 17:43
Parse Markers from Audition Session File to Chapter List
- (BOOL)application:(NSApplication*)app openFile:(NSString*)file{
NSData *data = [[NSData alloc] initWithContentsOfFile:file];
NSString *query = @"/sesx/session/xmpMetadata";
NSArray *result = PerformXMLXPathQuery(data, query);
NSString *xmpQuery = @"/x:xmpmeta/rdf:RDF/rdf:Description/xmpDM:Tracks/rdf:Bag/rdf:li/xmpDM:markers/rdf:Seq";
NSString *xmpMetadataString = [[[[result objectAtIndex:0] objectForKey:@"nodeChildArray"] objectAtIndex:0] objectForKey:@"nodeContent"];
NSData *xmpMetadataData = [xmpMetadataString dataUsingEncoding:NSUTF8StringEncoding];