Skip to content

Instantly share code, notes, and snippets.

View emranovin's full-sized avatar
🏠
Working from home

Emran emranovin

🏠
Working from home
View GitHub Profile
@mattio
mattio / App-re-signing.md
Last active January 14, 2025 08:41
Re-signing an .ipa file for iOS distribution

Re-signing an .ipa file for iOS distribution

There are several apps I currently have to re-sign. They are apps built by various outside vendors who do not want to share the source code, but we want the apps published from our account and we do not want to give them our certificate or access to publish the apps on our behalf. ¯\_(ツ)_/¯ These are the steps I use to re-sign them. I've decided to keep the steps manual because, frankly, it's an error-prone process, something done infrequently, and a moving target. Some detail always seems to shift with every major Xcode release or App Store change.

These steps are current as of iOS 14 and Xcode 12. They assume you already have your Distribution Certificate installed in Keychain.


I'm going to use an example named "Matt's App.ipa". If you need to provide instructions to a vendor to deliver this file to you properly, I've included what I use below.

@amosavian
amosavian / App-Bridging-Header.h
Last active February 11, 2019 16:10
Workaround OneSignal embargo
/// Add these lines to your app bridging header
#import <OneSignal/OneSignal.h>
#import "OneSignalTweak.h"
extension String {
private func regionalIndicatorSymbol(unicodeScalar: UnicodeScalar) -> UnicodeScalar? {
let uppercaseA = UnicodeScalar("A")!
let regionalIndicatorSymbolA = UnicodeScalar("\u{1f1e6}")!
let distance = unicodeScalar.value - uppercaseA.value
return UnicodeScalar(regionalIndicatorSymbolA.value + distance)
}
public var emojiFlag: String {
return self.uppercased().unicodeScalars.map({
@fearblackcat
fearblackcat / proxy_for_terminal.md
Last active March 1, 2025 18:17
Set proxy for terminal on mac

Shadowsocks Proxy

apt-get install python-pip
pip install shadowsocks

sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start
func validate(id: String) -> Bool {
guard id.characters.count < 11, let num = Int64(id) else { return false }
guard (num / 10) % 1000000 > 0 else { return false }
let checkNumber = Int(num % 10)
let digits = id.characters.map { Int(String($0))! }
let digitCount = digits.count
let sum = digits.dropLast().enumerated().reduce(0) { $0 + (digitCount - $1.offset) * $1.element }
let r = sum % 11
return (r < 2 && checkNumber == r) || (r >= 2 && checkNumber == (11 - r))
}
@ijoshsmith
ijoshsmith / Array+Shuffle.swift
Last active December 24, 2018 21:55
Randomly shuffle a Swift array
import Foundation
extension Array
{
/** Randomizes the order of an array's elements. */
mutating func shuffle()
{
for _ in 0..<10
{
sort { (_,_) in arc4random() < arc4random() }
var randomNumbers = [42, 12, 88, 62, 63, 56, 1, 77, 88, 97, 97, 20, 45, 91, 62, 2, 15, 31, 59, 5]
func partition(v: Int[], left: Int, right: Int) -> Int {
var i = left
for j in (left + 1)..(right + 1) {
if v[j] < v[left] {
i += 1
(v[i], v[j]) = (v[j], v[i])
}
}
@calebd
calebd / ArrayHelpers.swift
Last active January 29, 2025 06:05
Swift Helpers
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {