Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '16/3/4'
# !/usr/bin/env python
import ftplib
import hmac
import subprocess, json, base64, binascii, time, hashlib, re, copy, textwrap
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
import os
import requests
import base64
import hmac
import datetime
from os.path import join, exists, relpath
@ficapy
ficapy / CSharp_project_recommend.py
Created February 23, 2016 15:23
今天开始学C#,找几个小项目看源码练练手
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '16/2/23'
import sys
if sys.version_info[0] < 3:
sys.exit(1)
from github import Github
@ficapy
ficapy / img_upload.py
Last active April 9, 2018 13:08
当做图床使用,读取粘贴板的图像保存上传,完成后将url地址写入到剪贴板
#!/usr/local/bin/python2
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '16/1/1'
import datetime
import os
import sys
import atexit
import requests
>>> from http import cookies
>>> cookies._getdate()
'Tue, 22 Dec 2015 06:47:08 GMT'
@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'
@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
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:
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
@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')