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/bash | |
# 请取标准输入,将 iptables 的规则转成 nginx acl 规则 | |
# 使用: | |
# iptables-save | ./ipt2acl.sh > acl.conf | |
# | |
# 目前只支持两种形式的 ACCEPT 规则 | |
# 1. INPUT -s [./0-9]+ -j ACCEPT | |
# 2. INPUT -m iprange --src-range [.0-9]+-[.0-9]+ -j ACCEPT | |
# |
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/bash | |
# 请取标准输入,将 iptables 的规则转成 nginx acl 规则 | |
# 使用: | |
# iptables-save | ./ipt2acl.sh > acl.conf | |
# | |
# 目前只处理两种形式的 ACCEPT 规则 | |
# 1. INPUT -s [./0-9]+ -j ACCEPT | |
# 2. INPUT -m iprange --src-range [.0-9]+-[.0-9]+ -j ACCEPT | |
# |
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
#!/usr/bin/env python2.7 | |
# coding: utf8 | |
""" """ | |
import sys | |
import re | |
import os | |
from ipip import IP |
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
#coding: utf8 | |
from functools import wraps | |
class logit(object): | |
def __init__(self, logfile='out.log'): | |
self.logfile = logfile | |
def __call__(self, func): | |
@wraps(func) |
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
$(function(){ | |
function getElementLeft(element){ | |
var actualLeft = element.offsetLeft; | |
var current = element.offsetParent; | |
while (current !== null){ | |
actualLeft += current.offsetLeft; | |
current = current.offsetParent; | |
} | |
return actualLeft; | |
} |
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
# 生成 socks5 协议的连接命令16进制数据,用于 haproxy的 tcp-check send-binary | |
# 参考: | |
# - <https://zh.wikipedia.org/wiki/SOCKS#SOCKS5>, "SOCKS5请求格式" 部分 | |
# - <http://cbonte.github.io/haproxy-dconv/configuration-1.7.html#4.2-tcp-check%20send-binary> | |
socks5_connect_binary = lambda domain, port: "05010003"+"%02x" % len(domain)+"".join(["%02x" % ord(x) for x in domain])+"%04x" % int(port) |
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
#!/usr/bin/env python2.7 | |
# coding: utf8 | |
""" 网易云音乐命令行版本<https://github.com/darknessomi/musicbox>登录工具 | |
因为使用内置的登录系统一直出现 501 错误码,所以写了这个小工具 | |
原理: | |
提取网页版登录的 response 供命令行版本使用, 从而得到 Cookie 和用户 ID 信息 | |
使用方法: | |
1. 使用 Chrome 打开网易云音乐网页版 |
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
import imp | |
class ConfigLoader(object): | |
def __init__(self): | |
self.__conf = None | |
def load_file(self, path): | |
assert self.__conf is None | |
if self.__conf is None: |
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
import logging | |
console = logging.StreamHandler() | |
console.setFormatter(logging.Formatter('%(levelname)s:%(name)s:%(asctime)s# %(message)s', | |
datefmt="%Y-%m-%d %H:%M:%S")) | |
logger = logging.getLogger("hls-grabber") | |
logger.addHandler(console) |
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
# coding: utf8 | |
from subprocess import check_output | |
from socket import inet_aton | |
import struct | |
try: | |
from cStringIO import StringIO | |
except ImportError: | |
from StringIO import StringIO |
NewerOlder