Skip to content

Instantly share code, notes, and snippets.

Kamil Borzym kam800

  • Poland
View GitHub Profile
@kam800
kam800 / IDETemplateMacros.plist
Created Sep 2, 2018
xcshareddata/IDETemplateMacros.plist
View IDETemplateMacros.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string> ___COPYRIGHT___</string>
<key>FILEHEADER_comment</key>
<string>FILEHEADER is the text placed at the top of every new text file. It can be overridden, but can not be removed.</string>
</dict>
</plist>
View lldb_read_fix.txt
# This snippet shows how to enable dyld `closured` and how to fix `read` implementation in dyld using lldb.
# Following text is a bash/lldb command mix and it contains the relevant stdout content and my comments.
// `DYLD_PRINT_WARNINGS=1` environment variable will print dyld logs
$ DYLD_PRINT_WARNINGS=1 lldb /Users/kamil.borzym/tmp/TestMacApp.app/Contents/MacOS/TestMacApp
(lldb) process launch --stop-at-entry
(lldb) image list
[ 0] D355CCB5-8584-33E3-8DF7-7BA95BAD41AF 0x0000000100000000 /Users/kamil.borzym/tmp/TestMacApp.app/Contents/MacOS/TestMacApp
View check_duplicated_classes.sh
#!/bin/bash
# This script checks the binary and all nested frameworks for duplicated classes (both ObjectiveC and Swift).
# The script fails if it finds any duplicated classes.
function print_classes() {
otool -ov "$1" |
sed -n '/Contents of (__DATA,__objc_classlist)/,/Contents of/p' | # all lines for (__DATA,__objc_classlist) section
egrep '^[0-9]' | # take just a class header
cut -d ' ' -f 3 | # take just a symbol name
View framework_to_bundle.sh
#!/bin/bash
source_framework_path="$1"
target_bundle_dir="$2"
framework_name="$(basename "${source_framework_path}")"
module_name="$(basename -s .framework "${framework_name}")"
bundle_name="${module_name}.bundle"
target_bundle_path="${target_bundle_dir}/${bundle_name}"
print_usage() {
View Bundle+Resources.swift
import Foundation
public extension Bundle {
private final class Marker {}
// Looking for bundle involves a lot of IO
private static let cache: NSCache<NSString, Bundle> = NSCache<NSString, Bundle>()
public static func resourcesBundle(forModuleName moduleName: String) -> Bundle {
View List keychain items using cycript
var results = new(id)
var query = @{ kSecReturnAttributes : kCFBooleanTrue,
kSecMatchLimit: kSecMatchLimitAll,
kSecClass: kSecClassGenericPassword,
kSecReturnData: kCFBooleanTrue }
SecItemCopyMatching(query, results)
var r = *results
@kam800
kam800 / TWTRGenericKeychainItem.m
Created Jan 20, 2016
Override TwitterKit keychain kSecAttrAccessible to kSecAttrAccessibleAfterFirstUnlock
View TWTRGenericKeychainItem.m
@import Foundation;
#import <objc/runtime.h>
@interface TWTRGenericKeychainItem: NSObject
- (NSMutableDictionary *)fullRawRepresentation;
@end
@interface TWTRGenericKeychainItem (KeychainFix)
@end
@kam800
kam800 / pbxproj_unused_files.rb
Created Jan 19, 2015
Prints files that where not added to all xcode targets given in parameter
View pbxproj_unused_files.rb
#
# pbxproj_unused_files.rb
# v.1.0.0
#
# Copyright (c) 2015 Kamil Borzym
# Released under the MIT License
#
require 'rubygems'
require 'json'
You can’t perform that action at this time.