Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
amosgyamfi / HelloAnimation.swift
Last active March 5, 2024 02:28
HelloAnimation.swift
//
// HelloAnimation.swift
// OpenvisionOS
//
// Created by Amos Gyamfi on 17.2.2024.
//
import SwiftUI
struct HelloAnimation: View {
@wh1te4ever
wh1te4ever / find_unexported_symbols.c
Last active December 13, 2023 12:39
find_unexported_symbols.c
// seohyun-gyu@MacBook-Pro-2 find_xpc_rich_error_create % gcc -o find_xpc_rich_error_create find_xpc_rich_error_create.c
// seohyun-gyu@MacBook-Pro-2 find_xpc_rich_error_create % ./find_xpc_rich_error_create
// Found image_name: /usr/lib/system/libxpc.dylib, libxpc_hdr: 0x7ff80647a000
// _xpc_rich_error_create address: 0x7ff80649362c
#include <stdio.h>
#include <dlfcn.h>
#include <pthread.h>
#include <mach-o/dyld_images.h>
@0xallie
0xallie / checkm8_downgrade.md
Last active February 2, 2024 08:47
Guide for downgrading checkm8 devices
@ollieatkinson
ollieatkinson / SVG.swift
Last active May 1, 2024 00:08
Utilise the private CoreSVG framework in Swift
import Darwin
import Foundation
import UIKit
// https://github.com/xybp888/iOS-SDKs/blob/master/iPhoneOS17.1.sdk/System/Library/PrivateFrameworks/CoreSVG.framework/CoreSVG.tbd
// https://developer.limneos.net/index.php?ios=17.1&framework=UIKitCore.framework&header=UIImage.h
@objc
class CGSVGDocument: NSObject { }
@julio-kim
julio-kim / CovidStat.js
Last active February 27, 2021 06:34
[Scriptable] 코로나 확진자 현황
const source = 'http://ncov.mohw.go.kr'
let webView = new WebView()
await webView.loadURL(source)
let covid = await webView.evaluateJavaScript(`
const baseSelector = 'div.mainlive_container div.liveboard_layout '
let date = document.querySelector(baseSelector + 'h2 span.livedate').innerText
let domestic = document.querySelector(baseSelector + 'div.liveNum_today_new ul li:nth-child(1) span.data').innerText
let overseas = document.querySelector(baseSelector + 'div.liveNum_today_new ul li:nth-child(2) span.data').innerText
csrutil disable
sudo nvram boot-args="intcoproc_unrestricted=1 kext-dev-mode=1 amfi_allow_any_signature=1 amfi_unrestrict_task_for_pid=1 PE_i_can_has_debugger=1 cs_enforcement_disable=1 amfi_get_out_of_my_way=1 amfi=0xff cs_debug=1 ipc_control_port_options=0"
sudo spctl --global-disable
sudo defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool NO
sudo defaults write /Library/Preferences/com.apple.security.coderequirements Entitlements -string always
sudo defaults write /Library/Preferences/com.apple.security.coderequirements AllowUnsafeDynamicLinking -bool YES
sudo defaults write /Library/Preferences/com.apple.security.libraryvalidation.plist DisableLibraryValidation -bool YES
defaults write com.apple.loginwindow DisableScreenLockImmediate -bool yes
@coolstar
coolstar / libblackjack.h
Last active October 10, 2022 10:56
libhooker/libblackjack headers
//
// libblackjack.h
// libblackjack
//
// Created by CoolStar on 2/24/20.
// Copyright © 2020 CoolStar. All rights reserved.
//
#include "libhooker.h"
@IsaacXen
IsaacXen / README.md
Last active May 2, 2024 09:57
(Almost) Every WWDC videos download links for aria2c.
@SheldonWangRJT
SheldonWangRJT / Map, FlatMap (CompactMap), Reduce, Filter & Sort.md
Last active March 21, 2022 20:04
Swift Map, FlatMap (CompactMap), Reduce, Filter & Sort

High Order Functions in iOS Swift

Written by Sheldon, please find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

It is exaggerating to say we don't need to use for loop or while loop any more but we can take advantage of the Swift language built in functions to do loops. If I give you a question now. Q: Assuming we have an optional nested array, please calculate the production of the values that are less than 5. let numbers: [[Int]?] = [[1, 3], nil, [2], [5, 10], nil, [4]], what is your best approach to do it?

And you know the solution that I am talking about is following Swift functions:

  1. Map
  2. FlatMap / CompactMap
@dannote
dannote / final-cut-pro-trial-reset.swift
Last active April 17, 2024 10:39
Final Cut Pro X trial reset
#!/usr/bin/swift
import Foundation
let path = URL(fileURLWithPath: NSString(string: "~/Library/Application Support/.ffuserdata").expandingTildeInPath)
let data = try! NSData(contentsOf: path) as Data
let dictionary = try! NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(data) as! NSDictionary
let mutableDictionary = dictionary.mutableCopy() as! NSMutableDictionary
for (key, value) in mutableDictionary {