Skip to content

Instantly share code, notes, and snippets.

View parallaxe's full-sized avatar

Hendrik parallaxe

View GitHub Profile
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
{% set prefix %}UI{% endset %}
{% set controller %}ViewController{% endset %}
import Foundation
import UIKit
{% macro className scene %}{% filter removeNewlines %}
{% if scene.customClass %}
in interface:
@property(nonatomic) CFRunLoopObserverRef runloopObserver;
in init:
self.runloopObserver = CFRunLoopObserverCreate(NULL, kCFRunLoopAllActivities, true, 0, &runloopCallback, NULL);
CFRunLoopAddObserver(CFRunLoopGetMain(), self.runloopObserver, kCFRunLoopCommonModes);
CFRunLoopRemoveObserver(CFRunLoopGetMain(), self.runloopObserver, kCFRunLoopCommonModes);
void runloopCallback(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) {
NSLog(@"runloop %lu", activity);
@parallaxe
parallaxe / gist:09e769d25d88d45fc98356705a027c24
Created November 20, 2017 12:30
Print the current task-role of an iOS-app
void printRole() {
task_category_policy_data_t category_policy;
mach_msg_type_number_t task_info_count = TASK_CATEGORY_POLICY_COUNT;
boolean_t get_default = FALSE;
kern_return_t result =
task_policy_get(mach_task_self(), TASK_CATEGORY_POLICY,
&category_policy,
&task_info_count, &get_default);
if(result != KERN_SUCCESS) {
NSLog(@"damn");
@parallaxe
parallaxe / continue_when_recursion_depth_not_equal_to.py
Created February 21, 2016 23:27
Struggling with debugging a recursive function? You've set a breakpoint that should only break on a certain recursion-depth? This command is meant to rescue. Set it as action to a breakpoint with the depth you want the breakpoint to stop as argument, like continue_when_recursion_depth_not_equal_to 2 to stop on a recursion-depth of 2.
import lldb
import commands
import optparse
import shlex
def create_continue_when_recursion_depth_not_equal_to_options():
usage = "usage: %prog <depth as stop-condition>"
description='''Struggling with debugging a recursive function? You've set a breakpoint that should only
break on a certain recursion-depth? This command is meant to rescue. Set it as action to a breakpoint
with the depth you want the breakpoint to stop as argument, like
@parallaxe
parallaxe / Copy content to clipboard.workflow
Created May 22, 2014 08:43
An Automator-workflow that enables you to copy the content of a selected file directly into the clipboard
export __CF_USER_TEXT_ENCODING=0x1F5:0x8000100:0x8000100; cat "$@" | pbcopy