Skip to content

Instantly share code, notes, and snippets.

View TheFox's full-sized avatar

Christian Mayer TheFox

View GitHub Profile
@TheFox
TheFox / tree.zig
Last active March 27, 2025 16:19
Zig Error
// Using Zig 0.14.0
pub const Node = struct {
allocator: Allocator,
children: ArrayList(Node),
parent: ?*Node,
max_level: usize,
...
pub fn init(allocator: Allocator, value: u8, level: usize) Node {
@TheFox
TheFox / call_category_loads.c
Last active August 29, 2015 14:15
Objc call_category_loads
// Original: http://www.opensource.apple.com/source/objc4/objc4-646/runtime/objc-loadmethod.mm
static BOOL call_category_loads(void){
// ...
int used = loadable_categories_used;
// ...
loadable_categories_used = 0;
// ...
new_categories_added = (loadable_categories_used > 0);
@TheFox
TheFox / lldb_01.txt
Last active August 22, 2024 03:33
Cracking Hopper App
:> lldb Hopper.app
lldb:> target create "Hopper.app"
error: unable to find CIE at 0xf1bf1410 for cie_id = 0x0e410000 for entry at 0x00001404.
error: unable to find CIE at 0xfb722890 for cie_id = 0x048e0583 for entry at 0x00002e0f.
Current executable set to 'Hopper.app' (x86_64).
lldb:> run
Process 86127 launched: 'Hopper.app' (x86_64)
Process 86127 exited with status = 45 (0x0000002d)
@TheFox
TheFox / mariadb_install.sh
Last active June 19, 2016 15:01
Install MariaDB and TokuDB.
#!/usr/bin/env bash
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
aptitude update
aptitude install mariadb-server
/etc/init.d/mysql stop
cp /etc/mysql/my.cnf /etc/mysql/my.cnf_ORG
# Change to bind-address = 0.0.0.0
# Change to basedir = /opt/mysql
@TheFox
TheFox / osx_notification_center.m
Last active June 19, 2016 15:01
Sample code how to send push notification to the Notification Center under Apples OS X 10.8 Mountain Lion.
NSUserNotification *note = [[NSUserNotification alloc] init];
[note setTitle:@"TestApp"];
[note setInformativeText:@"Hello World!"];
NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter];
[center scheduleNotification: note];
@TheFox
TheFox / exportable.php
Last active August 29, 2015 14:02
PHP Exportable Class
<?php
/*
* @author Christian Mayer <http://fox21.at>
* @link http://stackoverflow.com/q/21762276/823644
* @link https://eval.in/163041
* @link https://eval.in/163462
* @link https://eval.in/163909
* @link https://gist.github.com/TheFox/49ff6903da287c30e72f
*/
@TheFox
TheFox / jsframeworks.md
Last active December 20, 2016 02:28
JavaScript Framework Collection

JavaScript Framework Collection

A collection of very nice JavaScript frameworks for developer.

Name Description
algorithms.js [S] Classic algorithms and data structures implemented in JavaScript, you know... FOR SCIENCE.
AngularJS [S] HTML enhanced for web apps.
Backbone.js [S] Backbone supplies structure to JavaScript-heavy applications by providing models key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.
beeplay.js [S][H] Write A Song On JavaScript.
@TheFox
TheFox / gc2dm.php
Last active December 22, 2015 08:39
Google Android Cloud to Device Messaging
<?php
/*
Role of the Third-Party Application Server
https://developers.google.com/android/c2dm/#server
*/
function gc2dmAuth($username, $password = null, $source = 'First-PushApp-1.0', $service = 'ac2dm'){
if($password === null || !$password){
#include <stdio.h>
#include <malloc.h>
#include <time.h>
#define TEST(f,x) (*(f+(x)/16)&(1<<(((x)%16L)/2)))
#define SET(f,x) *(f+(x)/16)|=1<<(((x)%16L)/2)
int main(int argc, char *argv[]){
unsigned char *feld = NULL, *zzz;
unsigned long teste = 1, max, mom, hits = 1, count, alloc, s = 0, e = 1;