This file contains hidden or 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
all: | |
gcc -shared -o testc.so testc.c -llua | |
win: | |
cl /MD /O2 -c -Ftestc.obj -I"%LUA_DEV%\include" testc.c /D __WINNT__ | |
link -dll -def:testc.def -out:testc.dll "%LUA_DEV%\lib\lua5.1.lib" testc.obj |
This file contains hidden or 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
#include <dlfcn.h> | |
typedef CFNotificationCenterRef (*fpCFNotificationCenterRef)(void); | |
typedef void (*fpCTTelephonyCenterAddObserver)(CFNotificationCenterRef center, const void *observer, CFNotificationCallback callBack, CFStringRef name, const void *object, CFNotificationSuspensionBehavior suspensionBehavior); | |
void callback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo); | |
int install_callback() | |
{ | |
void *framework = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY); | |
fpCFNotificationCenterRef CTTelephonyCenterGetDefault = (fpCFNotificationCenterRef)dlsym(framework, "CTTelephonyCenterGetDefault"); | |
if (CTTelephonyCenterGetDefault == NULL) { |
This file contains hidden or 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/ruby | |
APP = "/Applications/Adobe Illustrator CS6/Adobe Illustrator.app/Contents/MacOS/Adobe Illustrator" | |
if File.size(APP) > 4096 | |
print "Rename" | |
NEWAPP = File.dirname(APP) + '/AICS6' | |
`mv "#{APP}" "#{NEWAPP}"` | |
end |
This file contains hidden or 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/ruby | |
# annidy 2014-6-11 | |
d = Dir.new(".") | |
max = 0 | |
d.each {|x| | |
m = /^\d+\./.match(x) | |
m = m or ["0"] | |
max = [max, m.to_s.to_i].max | |
} |
This file contains hidden or 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
- (void)baseView | |
{ | |
BOOL hasAlertView = FALSE; | |
UIView* baseView = [UIApplication sharedApplication].keyWindow; | |
for (UIWindow* w in [UIApplication sharedApplication].windows) { | |
for (UIView *o in w.subviews) | |
{ | |
[self dismissAlertView:o didDismiss:&hasAlertView]; | |
} | |
} |
This file contains hidden or 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
@implementation NSString (CoreAdditions) | |
/* | |
URL encode | |
*/ | |
- (NSString *)encodeURIComponent_NON_ARC | |
{ | |
static NSString * const kLegalCharactersToBeEscaped = @"!*'();:@&=+$,/?%#[]"; | |
return [(NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, | |
(CFStringRef)self, |
This file contains hidden or 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
tell application "Finder" | |
set my_folder_path to container of (path to me) as text | |
set my_folder_path to POSIX path of my_folder_path | |
set my_path to my_folder_path & "smv" | |
end tell | |
tell application "Google Chrome" | |
activate | |
open location "http://www.baidu.com" | |
end tell |
This file contains hidden or 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/sh | |
#获取第一个参数,也就是要用于重新签名的IPA名称 | |
OLD_IPA=$1 | |
#获取第二个参数,也就是重新签名之后的IPA名称 | |
NEW_IPA=$2 | |
if [ $# -ne 2 ] | |
then | |
echo "Usage: `basename $0` old.ipa new.ipa" |
This file contains hidden or 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
// | |
// NSObject+Blocks.h | |
// Filemator | |
// | |
// Created by Zachary Waldowski on 4/12/11. | |
// Copyright 2011 Dizzy Technology. All rights reserved. | |
// | |
@interface NSObject (Blocks) |
This file contains hidden or 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
int GetSignalStrength() | |
{ | |
static int (*CTGetSignalStrength)() = GetSignalStrength; | |
if (CTGetSignalStrength == GetSignalStrength) { | |
void *libHandle = dlopen("/System/Library/Frameworks/CoreTelephony.framework/CoreTelephony", RTLD_LAZY); | |
CTGetSignalStrength = dlsym(libHandle, "CTGetSignalStrength"); | |
dlclose(libHandle); | |
} | |
if( CTGetSignalStrength == NULL) { |