Skip to content

Instantly share code, notes, and snippets.

View phoenixxie0's full-sized avatar

phoenix phoenixxie0

View GitHub Profile
@phoenixxie0
phoenixxie0 / gist:4523044
Last active December 11, 2015 01:19
Python get web files
from os.path import basename
from urlparse import urlsplit
import sys, urllib2
def url2name(url):
return basename(urlsplit(url)[2])
def download(url, localFileName = None):
localName = url2name(url)
req = urllib2.Request(url)
@phoenixxie0
phoenixxie0 / gist:4524266
Created January 13, 2013 14:06
Python downluad and extractall
import urllib2
from zipfile import *
import zipfile
# Install proxy support for urllib2
proxy_handler = urllib2.ProxyHandler({"https" : "http://127.0.0.1:8087"})
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)
# List the content of a directory (it returns an HTML page built by the proxy)
@phoenixxie0
phoenixxie0 / gist:5569407
Created May 13, 2013 16:00
python查看APPID剩余流量
# -*- coding: utf-8 -*-
import urllib
import re
d = 1000 #这里1000改成你的APPID的数目
#url = 'http://www.baidu.com'
url = 'http://wwqgtxxproxy-1.appspot.com/2'
html = urllib.urlopen(url).read()
m = re.search(r'<title>(.*)</title>', html, flags=re.I)
#print m.group(1)#or ''
@phoenixxie0
phoenixxie0 / Daemon.c
Last active November 26, 2016 12:30
一个C语言编写的简易守护进程..
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
void init_daemon(void); /*守护进程初始化函数*/
@phoenixxie0
phoenixxie0 / makehaproxy
Last active October 20, 2018 12:55
haproxy编译脚本
#!/bin/sh
make -j2 TARGET=linux2628 ARCH="64" CPU=native CFLAGS="-g -O3 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2" USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 ADDLIB=-ldl USE_STATIC_PCRE=1 USE_PCRE_JIT=1 USE_THREAD=1 USE_PTHREAD_PSHARED=1 USE_TFO=1 USE_GETADDRINFO=1 USE_NS=1 USE_SYSTEMD=1 PREFIX=/opt SSL_LIB=/usr/local/lib
mv -f /opt/sbin/haproxy /opt/sbin/haproxy.old && cp ./haproxy /opt/sbin/
@phoenixxie0
phoenixxie0 / build-mbedtls.sh
Created October 20, 2018 12:59
build-mbedtls.sh
#!/bin/sh
make lib CFLAG='-g -O3 -pipe -march=native -msse4.2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2'
mkdir -p /usr/local/include/mbedtls
cp -r include/mbedtls /usr/local/include
mkdir -p /usr/local/lib
cp -RP library/libmbedtls.* /usr/local/lib
cp -RP library/libmbedx509.* /usr/local/lib
cp -RP library/libmbedcrypto.* /usr/local/lib
@phoenixxie0
phoenixxie0 / v2ray-updare.sh
Created October 20, 2018 13:00
v2ray-updare.sh
#!/bin/bash
# This file is accessible as https://install.direct/go.sh
# Original source is located at github.com/v2ray/v2ray-core/release/install-release.sh
CUR_VER=""
NEW_VER=""
ZIPFILE="/tmp/v2ray/v2ray.zip"
#######color code########
RED="31m"
@phoenixxie0
phoenixxie0 / Cloudflare-check-ip.sh
Last active September 15, 2020 11:46
Cloudflare ip auto check for docker
#!/bin/bash
# random cloudflare anycast ip
sed 's/deb.debian.org/mirrors.aliyun.com/g' -i /etc/apt/sources.list
apt update
apt install -y --no-install-recommends netbase curl ca-certificates
rm -rf /var/lib/apt/lists/*
cd /tmp
rm -rf ip.txt
i=$[($RANDOM*2+1)%255]
echo 104.16.0.$i >> ip.txt