Skip to content

Instantly share code, notes, and snippets.

#ifndef WIN32
#include <dlfcn.h>
#include <stdio.h>
#include <vector>
#if DEBUG
void* malloc(size_t sz) {
static void *(*libc_malloc)(size_t) = nullptr;
if(libc_malloc==nullptr) {
@talaviram
talaviram / add_debug_entitlement.sh
Last active July 15, 2024 10:58
Simple Utility Script for allowing debug of hardened macOS apps.
#! /bin/bash
# Simple Utility Script for allowing debug of hardened macOS apps.
# This is useful mostly for plug-in developer that would like keep developing without turning SIP off.
# Credit for idea goes to (McMartin): https://forum.juce.com/t/apple-gatekeeper-notarised-distributables/29952/57?u=ttg
# Update 2022-03-10: Based on Fabian's feedback, add capability to inject DYLD for sanitizers.
#
# Please note:
# - Modern Logic (on M1s) uses `AUHostingService` which resides within the system thus not patchable and REQUIRES to turn-off SIP.
# - Some hosts uses separate plug-in scanning or sandboxing.
# if that's the case, it's required to patch those (if needed) and attach debugger to them instead.
@kurash
kurash / pkgresign.c
Created October 16, 2019 13:05
Add RSA signature to OSX packages (pkg)
/*
(c) 2012-2016 Sassafras Software Inc.
Provided "as is" under the terms of the MIT license, no warranty, use at your own risk
*/
/*
to build:
cc pkgresign.c -framework Security -framework CoreFoundation -lxar -o pkgresign
*/
@olilarkin
olilarkin / notes.md
Last active June 7, 2024 08:57
Plugin Dev Notes

Best Practices and What’s New with In-App Purchases

Introductory prices

SKProduct.introductoryPrice is an instance of SKProductDiscount. Just like a normal SKProduct, SKProductDiscount has a price and priceLocale. It also has a subscriptionPeriod. This period has a unit in the form of a month, week, month, year and a number of units. For instance 3 month units is possible. There is also a numberOfPeriods. Another property on SKProductDiscount is paymentMode.

If you have a 3 month cycle for your subscriptions, you can offer 6 months of access for a discount by setting numberOfPeriods to 2. If you set paymentMode to payAsYouGo, the user pays the second period after the first ends. You could also do a payUpFront setting so the user will pay the first two periods all at once. After the 6 month trial is up, the next renewal is for three months.

The last paymentMode is freeTrial, this gives the entire introductory period to the user for free.

Since iOS 11.2, subscriptionPeriod

@bmatcuk
bmatcuk / symbolizing_osx_crash_logs.md
Created May 29, 2014 21:43
How to symbolize OSX crash logs

How to Symbolize OSX Crash Logs

Unfortunately, xcode does not yet have support for importing OSX crash logs and symbolizing them. Therefore, you must use the command line and a little bit of manual work.

  1. Find your dSYM file.
    1. Assuming you are using xcode's archive functionality, open the Organizer window from the Window menu.
    2. Click the Archives tab.
    3. Right click on the appropriate build and select Show in Finder.
    4. When Finder opens, right click on the selected archive and select Show Package Contents.
    5. Navigate to the dSYM directory and copy the appropriate dSYM file to a temporary directory.
  2. Then navigate to Products, then Applications, and copy the app file to the same temporary directory.