Skip to content

Instantly share code, notes, and snippets.

View zrzka's full-sized avatar
👓
Trying to do something

Robert Vojta zrzka

👓
Trying to do something
View GitHub Profile
@zrzka
zrzka / gist:1251278
Created September 29, 2011 17:01
sqlite3 integrity check
+ (BOOL)checkIntegrity {
NSString *databasePath = [self databaseFilePath];
// File not exists = okay
if ( ! [[NSFileManager defaultManager] fileExistsAtPath:databasePath] ) {
return YES;
}
const char *filename = ( const char * )[databasePath cStringUsingEncoding:NSUTF8StringEncoding];
sqlite3 *database = NULL;
@zrzka
zrzka / prune-old-branches.sh
Created May 31, 2012 14:08
Git - prune remote origin and delete local branches
#!/bin/bash
#
# Written by Robert Vojta <robert@tapmates.com>
#
# This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
#
# http://creativecommons.org/licenses/by-sa/3.0/
#
- (void)windowDidResize:(NSNotification *)notification {
[self display];
if ( self.hasShadow ) {
[self invalidateShadow];
}
}
/* Remaining time for the next nutrition alarm */
RVRemainingTime=RVUserInterval-Suunto.mod(SUUNTO_DURATION, RVUserInterval);
/* Should we beep? */
if ( SUUNTO_DURATION > 0 && RVRemainingTime == RVUserInterval ) {
/* Decide what we should use */
if ( Suunto.mod( RVAlarmsCounter, RVUserGelCount + RVUserFoodCount ) < RVUserGelCount ) {
/* Use gel */
RVBeepCounter=RVUserGelBeepsCount;
RVGelPrefix=1;
/*
As of 5/13/2013 3:06PM Central Time this script is working. Tweet @runspired to report malfunctions.
*/
/*
Use the Javascript console in Google Chrome and the tcx2nikeplus converter located here: http://www.awsmithson.com/tcx2nikeplus/
This will take some time to run but will port all of your garmin data to nike+.
@zrzka
zrzka / youtrack-workflow.sh
Last active August 29, 2015 14:08
Youtrack Workflow launch script
#!/bin/sh
UNAME=`uname`
SCRIPT_PATH="$0"
if [ "${UNAME}" = "Linux" ]; then
# readlink resolves symbolic links, but on linux only
SCRIPT_PATH=`readlink -f "$0"`
fi
PROJECT_HOME="/Applications/youtrack-workflow.app"
PROJECT_HOME_FROM_STARTUP_DIR=..
@zrzka
zrzka / gist:3ae34814eb597c69bbff
Created December 4, 2014 09:31
Ukázka podepisování requestů
- (NSString *)signatureWithPlainText:(NSString *)plainText key:(NSString *)key {
const char *charKey = [key cStringUsingEncoding:NSASCIIStringEncoding];
const char *charData = [plainText cStringUsingEncoding:NSASCIIStringEncoding];
unsigned char charHMAC[CC_SHA1_DIGEST_LENGTH];
CCHmac( kCCHmacAlgSHA1, charKey, strlen( charKey ), charData, strlen( charData ), charHMAC);
NSData *data = [[NSData alloc] initWithBytes:charHMAC length:sizeof( charHMAC )];
return [data base64EncodedStringWithOptions:0];
@zrzka
zrzka / gist:3f0bd36d095826449850
Created December 4, 2014 11:42
Bezpečnost - 2 - HTTPS - Hooknutí na naši metodu
@import com.saurik.substrate.MS
NSLog_ = dlsym(RTLD_DEFAULT, "NSLog")
NSLog = function() { var types = 'v', args = [], count = arguments.length; for (var i = 0; i != count; ++i) { types += '@'; args.push(arguments[i]); } new Functor(NSLog_, types).apply(null,$
var oldm = {};
MS.hookMessage( ViewController, @selector(signatureWithPlainText:key:), function( text, key ) {
NSLog( @"Text: ->%@<-", text );
NSLog( @"Key: ->%@<-", key );
return oldm->call( this, text, key );
@zrzka
zrzka / swift-fronted-help-hidden-diff.txt
Created June 29, 2015 22:47
Xcode 7B2 Swift hidden options
15a16
> -interpret Immediate mode
17a19
> -repl REPL mode (the default if there is no input file)
20,22c22,45
< -application-extension Restrict code to those available for App Extensions
< -assert-config <value> Specify the assert_configuration replacement. Possible values are Debug, Release, Replacement.
< -color-diagnostics Print diagnostics in color
---
> -application-extension Restrict code to those available for App Extensions
@zrzka
zrzka / main.ir.txt
Created July 9, 2015 16:21
Tuples fun
; ModuleID = '-'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.10"
%Si = type <{ i64 }>
%VSs5Int32 = type <{ i32 }>
%VSs20UnsafeMutablePointer = type <{ i8* }>
@_Tv4main9oneSimpleSi = global %Si zeroinitializer, align 8
@_Tv4main8oneTupleSi = global %Si zeroinitializer, align 8