Skip to content

Instantly share code, notes, and snippets.

View fannheyward's full-sized avatar
🎯
Slow to response

Heyward Fann fannheyward

🎯
Slow to response
View GitHub Profile
@fannheyward
fannheyward / git paging.md
Created July 24, 2020 05:02 — forked from hutusi/git paging.md
Git checkout next / prev commit

Treat git log as a book, exec git next or git prev to checkout the next or the previous commit.

@fannheyward
fannheyward / Installation.md
Last active September 10, 2019 06:55 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
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)
@fannheyward
fannheyward / surf.conf
Created August 25, 2016 04:09 — forked from networkextension/surf.conf
surf.conf
# 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 服务器
# 你可以从该 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, 那么这些值会被写入到系统网络代理
# 设置中.)
// 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;
# 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 {
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)
myApp.directive('markdown', function () {
var converter = new Showdown.converter();
return {
restrict: 'AE',
link: function (scope, element, attrs) {
if (attrs.markdown) {
scope.$watch(attrs.markdown, function (newVal) {
var html = converter.makeHtml(newVal);
element.html(html);
});
/**
* Loading Indicator
*
* @author Maikel Daloo
* @date 12th March 2013
*
* Creates a new module and intercepts all ajax requests.
* Every time a request is sent, we display the loading message and increment
* the enable_counter variable. Then when requests complete (whether success or error)
* we increment the disable_counter variable and we only hide the loading message