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
local redis_c = require "resty.redis" | |
local ok, new_tab = pcall(require, "table.new") | |
if not ok or type(new_tab) ~= "function" then | |
new_tab = function (narr, nrec) return {} end | |
end | |
local _M = new_tab(0, 155) |
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
# A.BIG.T rule config | |
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备 | |
# Version 2.0 | |
[General] | |
# 日志等级: error,warning, notify, info, verbose (默认值: info) | |
loglevel = info | |
# 跳过某个域名或者 IP 段,这些目标主机将不会由 A.BIG.T 处理。 | |
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local | |
# 强制使用特定的 DNS 服务器 |
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
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf | |
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备 | |
# Version 2.0 | |
[General] | |
# 日志等级: warning, notify, info, verbose (默认值: notify) | |
loglevel = notify | |
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS | |
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理 | |
# 设置中.) |
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
// Include https://github.com/steipete/Aspects in your project | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
[UIButton aspect_hookSelector:@selector(touchesEnded:withEvent:) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo> info) { | |
UIButton *button = [info instance]; | |
UIView *topMostView = button.window.subviews.firstObject; | |
[self logSubviews:topMostView]; | |
} error:nil]; | |
return YES; |
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
# sniproxy example configuration file | |
# lines that start with # are comments | |
# lines with only white space are ignored | |
user daemon | |
# PID file | |
pidfile /var/run/sniproxy.pid | |
resolver { |
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
NginX/NginX OpenResty的内建及扩展模块的phase先后执行次序: | |
参考: http://wiki.nginx.org/Phases | |
http://blog.sina.com.cn/openresty | |
需要关注的phase有: | |
-1:http config: | |
在/usr/local/openresty/nginx/conf/nginx.conf的http段落有可以载入lua的共用函数, 比如: | |
init_by_lua_file /var/workspace/www/violation_nginx/lf; | |
0.server selection: server(listen, server_name) |
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
#include <sys/xattr.h> | |
if (!&NSURLIsExcludedFromBackupKey) { | |
// iOS <= 5.0.1 | |
const char *filePath = [[URL path] fileSystemRepresentation]; | |
const char *name = "com.apple.MobileBackup"; | |
u_int8_t value = 1; | |
int result = setxattr(filePath, name, &value, sizeof(value), 0, 0); | |
} else { | |
// iOS >= 5.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
NSArray *array = [[NSUserDefaults standardUserDefaults] valueForKey:@"fontURLs"]; | |
NSMutableArray *fontURLs = [NSMutableArray arrayWithArray:array]; | |
for (NSString *urlString in fontURLs) { | |
NSURL *url = [NSURL URLWithString:urlString]; | |
CTFontManagerRegisterFontsForURL((__bridge CFURLRef)url, kCTFontManagerScopeProcess, nil); | |
} |
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
app.factory('myService', function($http) { | |
var myService = { | |
async: function() { | |
// $http returns a promise, which has a then function, which also returns a promise | |
var promise = $http.get('test.json').then(function (response) { | |
// The then function here is an opportunity to modify the response | |
console.log(response); | |
// The return value gets picked up by the then in the controller. | |
return response.data; | |
}); |
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
// Your app's root module... | |
angular.module('MyModule', [], function($httpProvider) | |
{ | |
// Use x-www-form-urlencoded Content-Type | |
$httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8'; | |
// Override $http service's default transformRequest | |
$httpProvider.defaults.transformRequest = [function(data) | |
{ | |
/** |