Skip to content

Instantly share code, notes, and snippets.

@danlipert
danlipert / locationdenial.m
Created September 12, 2011 22:35
iOS location services denial handling
/* found on stack overflow: http://stackoverflow.com/questions/3401757/locationservicesenabled-test-passes-when-they-are-disabled-in-viewdidload
also: http://stackoverflow.com/questions/2333344/how-to-handle-dont-allow-for-location-manager
*/
- (void)locationManager: (CLLocationManager *)manager
didFailWithError: (NSError *)error {
NSString *errorString;
[manager stopUpdatingLocation];
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:videoConnection
completionHandler:^(CMSampleBufferRef imageSampleBuffer, NSError *error) {
if(!error)
{
if(imageSampleBuffer != NULL)
{
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
UIImage *image = [[UIImage alloc] initWithData:imageData];
NSLog(@"Captured image size: %f, %f", image.size.width, image.size.height);
<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@danlipert
danlipert / AxisM1014.json
Created January 30, 2015 07:22
Axis M1014 Calibration
{
"dist": [
[
-0.3929106197694297,
0.24569913424584497,
0.004538940733908437,
0.011785326233767003,
-0.13026915051298807
]
],
@danlipert
danlipert / gist:fbde565c201d05a3afc9
Created February 27, 2015 23:13
Example JSON Manifest
{
"recordingStart": "2007-11-06T16:34:41.000Z",
"recordingEnd": "2007-11-06T17:34:41.000Z",
"side": "left",
"metadata": {
"boatID": "dsf923rin",
"key": "value",
"etc": "etc"
}
}
Fri May 29 13:34:31 2015 SLEEP_PASSED = [4]
Fri May 29 13:34:31 2015 SLEEP_FAILED = [1]
Fri May 29 13:34:31 2015 FILE_MSG = [/tmp/log.msg.txt]
Fri May 29 13:34:31 2015 real 0m0.053s UP
Fri May 29 13:34:35 2015 real 0m0.027s UP
Fri May 29 13:34:39 2015 real 0m0.102s UP
Fri May 29 13:34:43 2015 real 0m0.026s UP
Fri May 29 13:34:47 2015 real 0m0.032s UP
Fri May 29 13:34:51 2015 real 0m0.030s UP
Fri May 29 13:34:55 2015 real 0m0.029s UP
0x3769773c09B74251a1668c8eB13108DB498DBe5a
@danlipert
danlipert / Blind-auction.solidity
Last active October 17, 2017 08:39
Blind Auction
pragma solidity ^0.4.11;
contract SimpleAuction {
// Parameters of the auction. Times are either
// absolute unix timestamps (seconds since 1970-01-01)
// or time periods in seconds.
address public beneficiary;
uint public auctionStart;
uint public biddingTime;
@danlipert
danlipert / MNReward.json
Created October 8, 2018 12:58
Masternode Reward Contract
"functionHashes": {
"balances(address)": "27e235e3",
"deposit()": "d0e30db0",
"getRegisteredLength()": "e98dcfd3",
"getWaitingLength()": "d1abc62a",
"isOwner()": "8f32d59b",
"owner()": "8da5cb5b",
"registered(uint256)": "e6cf1346",
"renounceOwnership()": "715018a6",
"reward()": "228cb733",
{
"body": {
"key": {
"eldest_kid": "012001ee2c3210300f368f32163bda88e9aa126738ff82037bb6d23fd7d35c2e3f600a",
"host": "keybase.io",
"kid": "012001ee2c3210300f368f32163bda88e9aa126738ff82037bb6d23fd7d35c2e3f600a",
"uid": "c6ef723594c4ce2ce8a3fce57da59919",
"username": "danlipert"
},
"merkle_root": {