Skip to content

Instantly share code, notes, and snippets.

View rpplusplus's full-sized avatar

Xiaoxuan Tang rpplusplus

View GitHub Profile
for a1 in 0..<4 {
for a2 in 0..<4{
for a3 in 0..<4 {
for a4 in 0..<4 {
for a5 in 0..<4 {
for a6 in 0..<4 {
for a7 in 0..<4 {
for a8 in 0..<4 {
for a9 in 0..<4 {
S-> a|^|(T)
T-> ST'
T'->,ST'|ε
First(S) = {a, ^, (}
First(T) = {a, ^, (}
First(T') = {, , ε}
Follow(S) = {, , $}
Follow(T) = {) , , , $}
@rpplusplus
rpplusplus / appDelegate
Last active August 29, 2015 14:11
Hello World
#import <objc/runtime.h>
#import <objc/message.h>
@implementation AppDelegate
id (*my_msgSend)(id, SEL, ...) = (void *)objc_msgSend;
void (*my_msgSend_)(id, SEL, ...) = (void *)objc_msgSend;;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@rpplusplus
rpplusplus / gist:f7cbf551cbefc7f9b4dc
Last active August 29, 2015 14:05
CFRuntime.__CFDoExternRefOperation
// we disguise pointers so that programs like 'leaks' forget about these references
#define DISGUISE(O) (~(uintptr_t)(O))
#if DEPLOYMENT_TARGET_MACOSX
#define NUM_EXTERN_TABLES 8
#define EXTERN_TABLE_IDX(O) (((uintptr_t)(O) >> 8) & 0x7)
#elif DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_WINDOWS || DEPLOYMENT_TARGET_LINUX
#define NUM_EXTERN_TABLES 1
#define EXTERN_TABLE_IDX(O) 0
#else
#!/bin/bash
## Mini-Xcode: XCode 5
MIN_VERSION="7.0"
# set default output folder is build
OUTPUT_FOLDER=${PREFIX-build}
# set default compiler
CC=${CC-$(xcrun --find gcc)}
@rpplusplus
rpplusplus / gist:6606861
Created September 18, 2013 09:41
full_permutation
#include <stdio.h>
#include <string.h>
int result_arr[100];
short flag_arr[100];
int result_cnt;
void
full_permutation(int arr[], int len_arr, int now_pos)
{
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXN 65536
int DD[5][2] = {{0, 0}, {0, 1}, {0, -1}, {-1, 0}, {1, 0}};
struct _queue_struct
{