Skip to content

Instantly share code, notes, and snippets.

ficapy ficapy

Block or report user

Report or block ficapy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View centos6_install_sentry.txt
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 / file_transfer.py
Last active Nov 16, 2015
CDN文件中转
View file_transfer.py
#!/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 / xiaomi_route_restart.py
Created Dec 15, 2015
小米路由器重启脚本,万一有人会用到呢
View xiaomi_route_restart.py
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 / ali_oss.py
Last active Dec 21, 2015
阿里云OSS单文件上传
View ali_oss.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
import requests
import base64
import hmac
import os
import sys
import datetime
View rfc1123.py
>>> from http import cookies
>>> cookies._getdate()
'Tue, 22 Dec 2015 06:47:08 GMT'
@ficapy
ficapy / VBA_replace.bas
Created Dec 20, 2013
建筑资料栋号递增批量打印PDF输出
View VBA_replace.bas
Option Explicit
'建筑资料栋号递增批量打印PDF输出
Sub replace()
Const F1 As String = "工程名称" '要修改单元格左边相邻单元格包含的内容
Dim k As Integer
Dim sh As Worksheet
Dim myStr As String
Dim myStr2 As String
Dim myStr3 As String
View oss_hexo.py
#!/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 / des3.py
Created Apr 20, 2016
3DES双倍长加密
View des3.py
from Crypto.Cipher import DES3
import binascii
# 3DES加密32位ASCII字符串得到32位ASCII字符串
# 密匙长度16bytes
# 3DES密文长度于明文长度相符,所以要加密得到32位明文中间有16进制转换('1F'→→→'\x1f')
# 加密前2个ASCII字符转换成1bytes(限制了只能是0-F)
def des3(key, msg):
cipher = DES3.new(binascii.unhexlify(key), DES3.MODE_ECB)
ret = cipher.encrypt(binascii.unhexlify(msg))
@ficapy
ficapy / hosts.py
Created Jul 13, 2016
代替/etc/hosts 当requests.get的时候使用指定的ip
View hosts.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '7/12/16'
import socket
import requests
def getitem(pos, seq):
@ficapy
ficapy / multi_processbar.py
Created Jul 15, 2016
使用ANSI控制符实现多行进度条 "\033[r;cH" 参考:https://www.student.cs.uwaterloo.ca/~cs452/terminal.html 缺点:运行时无法获取当前光标行数print('\033[6n', end='')
View multi_processbar.py
from __future__ import print_function
import random
import time
import sys
if not sys.stdout.isatty() or sys.version_info[0] == 2:
sys.exit(2)
You can’t perform that action at this time.