Skip to content

Instantly share code, notes, and snippets.

View baranxem's full-sized avatar
👨‍💻
It’s not a bug – it’s an undocumented feature.

Baran Emre baranxem

👨‍💻
It’s not a bug – it’s an undocumented feature.
  • emmi media GmbH
  • Düsseldorf, Germany
View GitHub Profile
//
// MKMapView+ZoomLevel.swift
// Monizze
//
// Created by Dylan Gyesbreghs on 23/06/2017.
// Copyright © 2017 DGyesbreghs. All rights reserved.
// https://oleb.net/blog/2010/05/set-the-zoom-level-of-mkmapview/
//
import MapKit
@baranxem
baranxem / Apple_mobile_device_types.txt
Created September 23, 2019 09:18 — forked from adamawolf/Apple_mobile_device_types.txt
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
iPhone5,1 : iPhone 5 (GSM)
@baranxem
baranxem / .lambda.yml
Created August 13, 2019 12:32 — forked from willyg302/.lambda.yml
A Lambda function for AES encryption/decryption, from a Gist!
config:
FunctionName: aws-lambda-aes-gist
Handler: index.handler
Runtime: nodejs
Description: A Lambda function for AES encryption/decryption, from a Gist!
install: npm install --production
@baranxem
baranxem / PrecisionTimer.swift
Created March 8, 2019 09:48 — forked from kandelvijaya/PrecisionTimer.swift
Precision Timing in iOS/OSX/Swift
//: Playground - noun: a place where code can play
import UIKit
//Most precise time keeper
// for more information on the benchmarks go to www.kandelvijaya.com
func timeBlockWithMach(_ block: () -> Void) -> TimeInterval {
var info = mach_timebase_info()
guard mach_timebase_info(&info) == KERN_SUCCESS else { return -1 }
@baranxem
baranxem / pbkdf2test.c
Created December 3, 2018 12:19 — forked from lukhnos/pbkdf2test.c
An example of using CommonCrypto's PBKDF2 function
// an example of using CommonCrypto's PBKDF2 function
//
// build with:
//
// clang -o pbkdf2test pbkdf2test.c
//
// test with:
//
// ./pbkdf2test <some plaintext password here>
@baranxem
baranxem / SHA256-Bridging-Header.h
Created December 3, 2018 12:11 — forked from hfossli/SHA256-Bridging-Header.h
AES 256 in swift 4 with CommonCrypto
#import <CommonCrypto/CommonCrypto.h>
@baranxem
baranxem / hello.h
Created October 24, 2018 17:17 — forked from ddrccw/hello.h
detect jailbreak
//
// Created by ddrccw on 14-1-10.
// Copyright (c) 2014年 ddrccw. All rights reserved.
// refer to http://danqingdani.blog.163.com/blog/static/1860941952012102122847478/
#import <sys/stat.h>
#import <mach-o/dyld.h>
//#import <stdlib.h>
//#import <string.h>
@baranxem
baranxem / DisableGDB.swift
Created October 23, 2018 19:45 — forked from mattlawer/DisableGDB.swift
Disable GDB with Swift 3
import Foundation
func disable_gdb() {
let PT_DENY_ATTACH: CInt = 31
let handle = dlopen("/usr/lib/libc.dylib", RTLD_NOW)
let sym = dlsym(handle, "ptrace")
typealias PtraceAlias = @convention(c) (CInt, pid_t, CInt, CInt) -> CInt
let ptrace = unsafeBitCast(sym, to: PtraceAlias.self)
_ = ptrace(PT_DENY_ATTACH, 0, 0, 0)
dlclose(handle)
@baranxem
baranxem / symbolicatecrash
Created October 21, 2018 14:20 — forked from saitjr/symbolicatecrash
Advance version of symbolicatecrash
#!/usr/bin/perl -w
#
# This script parses a crashdump file and attempts to resolve addresses into function names.
#
# It finds symbol-rich binaries by:
# a) searching in Spotlight to find .dSYM files by UUID, then finding the executable from there.
# That finds the symbols for binaries that a developer has built with "DWARF with dSYM File".
# b) searching in various SDK directories.
#
# Copyright (c) 2008-2015 Apple Inc. All Rights Reserved.
import Foundation
import PlaygroundSupport
/// A thread-safe array.
public class SynchronizedArray<Element> {
fileprivate let queue = DispatchQueue(label: "io.zamzam.ZamzamKit.SynchronizedArray", attributes: .concurrent)
fileprivate var array = [Element]()
}
// MARK: - Properties