Skip to content

Instantly share code, notes, and snippets.

@ficapy
ficapy / chardetect.py
Created September 10, 2015 03:36
编码检测
total = 2292627
import sys
import codecs
from encodings.aliases import aliases
import mmap
all_encoding = aliases.values()
all_encoding = list(set(all_encoding))
from concurrent.futures import ThreadPoolExecutor, as_completed
from user_agent import generate_user_agent
import requests
from pyquery import PyQuery as pq
def singal_parse(id):
url = 'http://www.miaoss.net/reg.php?id={}'.format(id)
ret = requests.get(url, params={'User-Agent': generate_user_agent()}, timeout=30)
ret.encoding = 'utf-8'
@ficapy
ficapy / ali_oss.py
Last active December 21, 2015 13:02
阿里云OSS单文件上传
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
import requests
import base64
import hmac
import os
import sys
import datetime
@ficapy
ficapy / file_transfer.py
Last active November 16, 2015 15:55
CDN文件中转
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
from __future__ import division, print_function
import sys
import re
import urllib
import sqlite3
import tempfile
@ficapy
ficapy / google_chrome_webstore_devtools_users_rank.py
Created October 27, 2015 12:21
谷歌浏览器应用商店使用人数排行 P.S 因木有代理 使用单线程执行,有极少部分请求被ban没有得到结果
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '15/10/27'
from pyquery import PyQuery as pq
from operator import attrgetter
from concurrent.futures import ThreadPoolExecutor, as_completed
from operator import methodcaller
import requests
@ficapy
ficapy / rsa_aes.py
Last active October 22, 2019 08:46
pycrypto使用AES/RSA加解密
# !/usr/bin/env python
# -*- coding: utf-8 -*-
from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA
from Crypto import Random
from Crypto.Cipher import AES
aes_obj_enc = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456')
OSX:
http://osxdaily.com/2013/05/31/create-large-file-mac-os-x/
mkfile -n size[b|k|m|g] filename
Others:
http://www.skorks.com/2010/03/how-to-quickly-generate-a-large-file-on-the-command-line-with-linux/
dd if=/dev/zero of=somefile bs=1 seek=1G count=0
sudo yum -y update
sudo yum groupinstall -y 'development tools'
sudo yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget
wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
xz -d Python-2.7.8.tar.xz
tar -xvf Python-2.7.8.tar
cd Python-2.7.8
# Run the configure:
@ficapy
ficapy / https.txt
Created November 20, 2015 07:22
Ubuntu/Debian HTTPS PROXY(nghttp2+squid3)
apt-get install g++ make binutils autoconf automake autotools-dev libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev libjemalloc-dev cython python3-dev python-setuptools
mkdir /nghttp2
git clone https://github.com/tatsuhiro-t/nghttp2.git
cd nghttp2
autoreconf -i
automake
autoconf
./configure
make
@ficapy
ficapy / xiaomi_route_restart.py
Created December 15, 2015 10:46
小米路由器重启脚本,万一有人会用到呢
import time
import random
import requests
from hashlib import sha1
key = 'a2ffa5c9be0748*********' # 登陆页面查看源码获得
deviceId = '98:5a:eb:*****'
pwd = '*************'
url = 'http://192.168.31.1/cgi-bin/luci/api/xqsystem/login'
reboot_url = 'http://192.168.31.1/cgi-bin/luci/;stok={}/api/xqsystem/reboot?client=web'