Skip to content

Instantly share code, notes, and snippets.

View beny's full-sized avatar
:octocat:
🆙 and 🏃‍♂️

Ondra Beneš beny

:octocat:
🆙 and 🏃‍♂️
View GitHub Profile
@beny
beny / gist:8313959
Last active March 14, 2022 11:41
Xcode tips

Core Data

  • -com.apple.CoreData.SQLDebug 1-3 - print all SQL queries called by Core Data
    • -com.apple.CoreData.Logging.stderr 1-3 - needed alongside with the SQLDebug from iOS 10+ because of new logging system, more on that in changelog
  • -com.apple.CoreData.SyntaxtColoredLogging YES - probably syntax colored logging (not tried)
  • -com.apple.CoreData.SQLiteDebugSynchronous 1 - preference controls some aspects of the SQLite store. See the "Configuring a SQLite Store's Save Behavior" section of the Core Data Programming Guide for details
  • -com.apple.CoreData.SQLiteIntegrityCheck 1 - the SQLite store does extra integrity checking
  • -com.apple.CoreData.MigrationDebug 1 - Core Data will log information about exceptional cases as it migrates data
  • -com.apple.CoreData.ThreadingDebug - preference enables assertions to enforce Core Data's multi-threading policy. It is a number, where incre
@beny
beny / gist:8313934
Last active January 2, 2016 13:59
LLDB tips

Breakpoints

breakpoint set -s method: - create breakpoint for all methods with selector method: po [(CALayer *)[[[[UIApplication sharedApplication] windows] objectAtIndex:0] layer] setSpeed:.1f]; - slow down all animations on device

@beny
beny / gist:7037968
Last active December 25, 2015 20:49
iOS crash logs locations

OS X

~/Library/Logs/CrashReporter/MobileDevice/<your iPhone’s name>/

Windows XP

C:\Documents and Settings\Application Data\Apple computer\Logs\CrashReporter\<your iPhone’s name>\

Windows Vista

C:\Users\AppData\Roaming\Apple computer\Logs\CrashReporter\MobileDevice\<your iPhone’s name>\

Windows 7

@beny
beny / gist:6077418
Last active December 20, 2015 05:19
Simple specific NSNotification logger
void NotificationLogger(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
NSString *notificationName = (__bridge NSString *)name;
NSRange prefixRange = [notificationName rangeOfString:@"OB"];
NSArray *excludeNotifications = @[@"OBNotInterestingNotification"];
if (prefixRange.location != NSNotFound && prefixRange.length != 0) {]) {
NSLog(@"Notification send %@ with userInfo %@", name, userInfo);
}
}
@beny
beny / gist:5729615
Created June 7, 2013 14:22
Color selected cell background with color defined inside as hex code (#aabbff)
Sub Color()
For Each rCell In Selection
rCell.Interior.Color = RGB(CInt("&H" & Mid(rCell.Value, 2, 2)), CInt("&H" & Mid(rCell.Value, 4, 2)), CInt("&H" & Mid(rCell.Value, 6, 2)))
Next rCell
End Sub
@beny
beny / gist:4329499
Last active December 9, 2015 21:18
Git config
[core]
excludesfile = ~/.gitignore
quotepath = false
[diff]
external = ~/.opendiff-git.sh
[merge]
tool = opendiff
[user]
name = Ondrej Benes
email = <my-email>
@beny
beny / gist:3834854
Created October 4, 2012 16:44
Xcode build number auto increment
conf=${CONFIGURATION}
if [ $conf != "Debug" ]
then
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${PROJECT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}-Info.plist)
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" ${PROJECT_DIR}/${PROJECT_NAME}/${PROJECT_NAME}-Info.plist
fi
@beny
beny / gist:3187985
Created July 27, 2012 13:22
git commands which cleans repo history index from too big files
git filter-branch --index-filter 'git rm --cached --ignore-unmatch -- *.mbtiles' --prune-empty -- --all
rm -fr .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
@beny
beny / mail_notes.rb
Created July 20, 2012 15:16
simple script, which finds Notes from iOS app in my Gmail
require "net/imap"
require "mail"
=begin
SAMPLE zpravy
Subject: =?utf-8?Q?Kv=C4=9Btin=C3=A1=C5=99stv=C3=AD_D=C4=9Bl=C5=88=C3=A1k?=
From: =?utf-8?Q?Ondra_Bene=C5=A1?= <[email protected]>
X-Universally-Unique-Identifier: DDC4E35E-7D70-4E97-8167-011B204229D3
@beny
beny / decrypt.rb
Created December 30, 2011 09:41
h4[K3r5 mini help
#!/usr/bin/ruby
#
# simple Brute-Force recursive algorithm for decrypting crypt function
# try whatever you want in crypt function
#
# enjoy
require 'zlib'
def decrypt(x)