Skip to content

Instantly share code, notes, and snippets.

@liaogang
liaogang / gcc macro_expand
Created December 8, 2021 02:01
gcc macro_expand
macro_expand> gcc source.c -E > result.c
@liaogang
liaogang / gist:671aa9aadeb95625edb7f9a637cb50c9
Created April 9, 2021 09:41
get or set a ivar of NSObject
//
// NSIvarOffset.h
// whatshook
//
// Created by minisj.net on 2020/11/17.
//
NS_ASSUME_NONNULL_BEGIN
@interface Objc : NSObject
@liaogang
liaogang / gist:54060daac610438668b1e8e45116c236
Created November 8, 2019 12:07 — forked from 4poc/gist:3155832
C++11 Callbacks with function and lambda
#include <iostream>
#include <vector>
#include <functional>
class WorkingClass {
public:
typedef const std::function<void (int)> handler_t;
void AddHandler(handler_t& h) {
handlerList.push_back(&h);
}
@liaogang
liaogang / gist:5d50377c87a7e6b92e9b8a1b402c833b
Created March 5, 2019 10:49
iOS separate cookie handler for multi users
/*
How to set cookieAcceptPolicy for ephemeral NSURLSession https://stackoverflow.com/questions/27290234/how-to-set-cookieacceptpolicy-for-ephemeral-nsurlsession
Multiple NSHTTPCookieStorage in the same app https://stackoverflow.com/questions/27132606/multiple-nshttpcookiestorage-in-the-same-app
NSHTTPCookieStorage for same URL but different users https://stackoverflow.com/questions/37597250/nshttpcookiestorage-for-same-url-but-different-users
*/
@interface NSHTTPCookieStorage (applePrivateHeader)
-(id)_initWithIdentifier:(id)arg1 private:(BOOL)arg2;
@end
@liaogang
liaogang / sbr.py
Created January 22, 2019 07:20
This is a python script of LLDB to set breakpoint using file address when ASLR is on. I copy from network and changed a little
#!/usr/bin/python
#coding:utf-8
import lldb
import commands
import optparse
import shlex
def get_ASLR(debugger):
App transport security settings
Allow arbitrary loads ==> YES
@liaogang
liaogang / test
Created January 19, 2016 07:00
test gist
test