- 定长协议: 每条协议的请求和响应应该是固定长度的。
- 小头编码:所有数字的字节都使用little-endian
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
-- port from golang: https://golang.org/src/time/time.go | |
-- | |
local secondsPerMinute = 60 | |
local secondsPerHour = 60 * 60 | |
local secondsPerDay = 24 * secondsPerHour | |
local secondsPerWeek = 7 * secondsPerDay | |
local daysPer400Years = 365*400 + 97 | |
local daysPer100Years = 365*100 + 24 | |
local daysPer4Years = 365*4 + 1 |
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 <syslog.h> | |
#include <lua.h> | |
#include <lauxlib.h> | |
#define LSYSLOG_FCOUNT 8 | |
static int facilitys[LSYSLOG_FCOUNT] = { | |
LOG_LOCAL0, | |
LOG_LOCAL1, |
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
package main | |
import ( | |
"bytes" | |
"flag" | |
"log" | |
"net" | |
"sync" | |
"time" | |
) |
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
package main | |
import ( | |
"crypto/tls" | |
"crypto/x509" | |
"flag" | |
"io" | |
"io/ioutil" | |
"log" | |
"os" |
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
#!/user/bin/python | |
# -*- coding: utf-8 -*- | |
import sys, logging | |
def inter_sort(lines): | |
m = {} | |
for i, line in enumerate(lines): | |
l = line.strip() | |
try: | |
_,suffix = l.lower().split("@") |
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 | |
PRIVATE_IP=8.8.8.8 | |
/bin/cp -f /etc/iptables.rules /etc/iptables.rules.old-$(date +%Y-%m-%d-%H:%M:%S) | |
cat > /etc/iptables.rules <<EOF | |
*filter | |
:INPUT ACCEPT [0:0] | |
:FORWARD ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
:ICMPALL - [0:0] |