Skip to content

Instantly share code, notes, and snippets.

import hashlib
import re
import time
from livestreamer.plugin import Plugin
from livestreamer.plugin.api import http, validate
from livestreamer.stream import HTTPStream
#from:https://github.com/chrippa/livestreamer/pull/970/commits
@userid
userid / ss-redir 透明代理.md
Last active September 14, 2015 04:01 — forked from wen-long/ss-redir 透明代理.md
ss-redir 透明代理.md

##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 可用,但端口一致,就设置这个
//$("#btnNext").attr("onclick");
index = {'A':'0', 'B':'1','C':2,'D':'3', 'E':'4','F':'5'};
var first =2;
function skip_q(){
first =2;
@userid
userid / tc_iptables.sh
Created August 27, 2015 10:21
使用TC和iptables限制网速
#!/bin/bash
iptables -t mangle -X
iptables -t mangle -F
#删除旧队列
tc qdisc del dev eth0 root
tc qdisc del dev eth1 root
#上传设置
##创建一个HTB的根,默认类为1:20
import urllib2
def xiami_decode(s):
s = s.strip()
if not s:
return False
result = []
line = int(s[0])
rows = len(s[1:]) / line
extra = len(s[1:]) % line
<?php // $Revision: 1.2 $
/************************************************************************/
/* phpAdsNew 2 */
/* =========== */
/* */
/* Copyright (c) 2000-2002 by the phpAdsNew developers */
/* For more information visit: http://www.phpadsnew.com */
/* */
/* This program is free software. You can redistribute it and/or modify */
@userid
userid / PHP7.md
Created July 16, 2015 09:22
php5 setup script

�##得到php7的最新代码: from https://wiki.php.net/phpng

git clone https://git.php.net/repository/php-src.git

##编译源代码:

./configure \
--prefix=/opt/php7 \
--with-config-file-path=/opt/php7/etc \
--with-config-file-scan-dir=/opt/php7/etc/conf.d \
@userid
userid / zabbix_proceduce.sql
Created July 16, 2015 06:33
zabbix 数据库表分区脚本
DELIMITER $$
CREATE PROCEDURE `partition_create`(SCHEMANAME VARCHAR(64), TABLENAME VARCHAR(64), PARTITIONNAME VARCHAR(64), CLOCK INT)
BEGIN
/*
SCHEMANAME = The DB schema in which to make changes
TABLENAME = The table with partitions to potentially delete
PARTITIONNAME = The name of the partition to create
*/
/*
Verify that the partition does not already exist
@userid
userid / dns_forwarder.py
Last active August 29, 2015 14:22
用python gevent简单实现的server,转发dns请求
#!/usr/bin/python2.7
# Copyright (c) 2012 Denis Bilenko. See LICENSE for details.
"""A simple UDP server.
For every message received, it sends a reply back.
You can use udp_client.py to send a message.
"""
from __future__ import print_function
import argparse,sys
#!/usr/bin/python
# -*- coding: utf8 -*-
# Simple RSA Implementation
# Authored by Jeremy <jeremy5189(at)gmail.com>
# Reference: http://www.ruanyifeng.com/blog/2013/07/rsa_algorithm_part_two.html
from fractions import gcd
import sys