Skip to content

Instantly share code, notes, and snippets.

View defp's full-sized avatar

lidashuang defp

View GitHub Profile
// define supported target platform macro which CC uses.
#define CC_PLATFORM_UNKNOWN 0
#define CC_PLATFORM_IOS 1
#define CC_PLATFORM_ANDROID 2
#define CC_PLATFORM_WIN32 3
#define CC_PLATFORM_MARMALADE 4
#define CC_PLATFORM_LINUX 5
#define CC_PLATFORM_BADA 6
#define CC_PLATFORM_QNX 7
--
-- Author: 张伟超
-- Date: 2014-08-07 09:53:25
--
function __G__TRACKBACK__(errorMessage)
print("----------------------------------------")
print("LUA ERROR: " .. tostring(errorMessage) .. "\n")
print(debug.traceback("", 2))
print("----------------------------------------")
end
defmodule Hello do
require Record
Record.defrecordp :file_info, Record.extract(:file_info, from_lib: "kernel/include/file.hrl")
def regular_file_info(path) do
case :file.read_file_info(path) do
{:ok, file_info(type: :regular) = file_info} ->
file_info
_ ->
nil
diff -Nru elixir_china/README.md elixir_china041/README.md
--- elixir_china/README.md 2014-12-30 20:58:19.000000000 +0800
+++ elixir_china041/README.md 2014-12-30 20:59:24.000000000 +0800
@@ -1,8 +1,13 @@
# ElixirChina
-To start your new Phoenix application:
+To start your new Phoenix application you have to:
1. Install dependencies with `mix deps.get`
#!/bin/sh
#create a new chain named SHADOWSOCKS
iptables -t nat -N SHADOWSOCKS
#Redirect what you want
#Google
iptables -t nat -A SHADOWSOCKS -p tcp -d 74.125.0.0/16 -j REDIRECT --to-ports 1080
iptables -t nat -A SHADOWSOCKS -p tcp -d 173.194.0.0/16 -j REDIRECT --to-ports 1080
server {
listen 90;
server_name 10.171.216.77;
location /ec_mobile {
proxy_pass http://121.40.123.81/ECMobile ;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
}

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
defmodule HelloWorld do
use Behaviour
defcallback hello(binary) :: binary
defcallback world(binary) :: binary
end
defmodule MyWorld do
@behaviour HelloWorld
@defp
defp / api.rb
Last active August 29, 2015 14:08
qiniu token
desc "获取上传头像qiniu token"
get 'uptoken' do
key = "#{current_user.id}_#{SecureRandom.hex}.jpg"
put_policy = PutPolicy.new(ENV['qiniu_bucket'], key)
put_policy.mime_limit = "image/*"
uptoken = QiniuToken.generate_uptoken(put_policy)
{ status: "ok", uptoken: uptoken }
end
@defp
defp / gittp.go
Last active August 29, 2015 14:08 — forked from shanzi/gittp.go
/*
gittip: a basic git http server.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright 2014 Chase Zhang <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long