This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef __WIN32__ | |
#include <windows.h> | |
typedef HANDLE mutex_t; | |
typedef HANDLE thread_t; | |
#define mutex_init(m) m = CreateMutex(NULL, FALSE, NULL) | |
#define mutex_lock(m) WaitForSingleObject(m, INFINITE) | |
#define mutex_unlock(m) ReleaseMutex(m) | |
#define mutex_destroy(m) CloseHandle(m) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ExtendedAttributes.h | |
// NSFileManager+Xattr | |
// | |
// Created by Jesús A. Álvarez on 2008-12-17. | |
// Copyright 2008-2009 namedfork.net. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <sys/xattr.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface UIColor (String) | |
+ (UIColor*)colorWithString:(NSString*)str; | |
- (UIColor*)initWithString:(NSString*)str; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSData (Hex) | |
- (NSString*)hexString; | |
- (NSString*)hexStringWithCaps:(BOOL)caps; | |
+ (NSData*)dataWithHexString:(NSString*)hexString; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
infix operator --> { associativity left precedence 80 } | |
func --><T:IntegerType>(inout left:T, right:T) -> Bool { | |
if left != right { | |
left = left.advancedBy(left > right ? -1 : 1) | |
return true | |
} else { | |
return false | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# wait until knock launches | |
while [ -z "`ps cax | grep Knock`" ]; do | |
sleep 3 | |
done | |
# wait a bit more | |
sleep 3 | |
# disable security agent support | |
lldb <<EOF | |
attach Knock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let points = [ | |
((-1, 0), (0,0), (13,25)), | |
((13, 22), (13, 24), (13, 23)), | |
((23, 12), (13, 17), (17, 12)), | |
((31, 16), (26, 12), (29, 14)), | |
((54, 0), (34, 7), (43, 0)), | |
((78, 24), (67, 0), (78, 11)), | |
((78, 27), (78, 25), (78, 26)), | |
((79, 27), (78, 27), (78, 27)), | |
((94, 42), (87, 27), (94, 33)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# iconv line by line with fallback encoding | |
require 'optparse' | |
options = { | |
from: Encoding::UTF_8, | |
to: Encoding::UTF_8, | |
fallback: Encoding::ISO_8859_1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
EUMShowTouchDropIn | |
single-file drop-in version | |
Copyright (c) 2014 Shawn Xiao <[email protected]> | |
Copyright (c) 2016 Jesús A. Álvarez <[email protected]> | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cc reenumerate.c -framework IOKit -framework CoreFoundation -o reenumerate | |
#include <stdio.h> | |
#include <CoreFoundation/CoreFoundation.h> | |
#include <IOKit/IOKitLib.h> | |
#include <IOKit/IOCFPlugIn.h> | |
#include <IOKit/usb/IOUSBLib.h> | |
#include <mach/mach.h> | |
#define kExcAccMaxWait 5 |
OlderNewer