Skip to content

Instantly share code, notes, and snippets.

View VeryCB's full-sized avatar

VeryCB VeryCB

View GitHub Profile
@VeryCB
VeryCB / taoke_url_2_real_url
Last active October 3, 2020 07:59
将淘客URL转换为商品的真实URL
#!/usr/bin/python
# -*- coding: utf-8 -*-
import requests
import urllib
def get_real_url(taoke_url):
_refer = requests.get(taoke_url).url
headers = {'Referer': _refer}
return requests.get(urllib.unquote(_refer.split('tu=')[1]), headers=headers).url.split('&ali_trackid=')[0]
@VeryCB
VeryCB / count_code_lines
Created September 15, 2013 16:56
count all lines of python code, ignoring `venv` directory
find . -path ./venv -prune -o -name '*.py' | xargs wc -l
@VeryCB
VeryCB / clean-git-branch
Last active October 3, 2020 07:59
This script helps removing Git branches. Run it from a git repo dir. It will open the Git branches list in your favorite editor. Delete some branches from the list. Save and close the file. The script applies the changes to the repo.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script helps removing Git branches.
# Run it from a git repo dir. It will open the Git branches list
# in your favorite editor. Delete some branches from the list.
# Save and close the file. The script applies the changes to the repo.
from subprocess import call, Popen, PIPE
from os import getenv
@VeryCB
VeryCB / qq.py
Created May 30, 2014 02:33
insert spaces between Chinese characters and copy to clipboard
import os
while True:
join_by = ' ' * 3
content = raw_input('say something: ')
content_list = [content[i:i+3] for i in range(0, len(content), 3)]
output = join_by.join(content_list)
os.system("echo '%s' | pbcopy" % output)
print 'copied "%s" to clipboard, now you can paste!' % output
var openApp = function() {
var a = xparamsString.sharefrom;
if (a) {
var b = "",
c = videoIdEn,
d = "";
if ("pkios" == a || "pkandroid" == a) null != window.navigator.userAgent.match(/android/i) && (b = "paike://vid/" + c), null != window.navigator.userAgent.match(/iphone|ipad/i) && (b = "paike://type=vid&value=" + c), d = "banner=pk";
if ("android" == a || "ipad" == a || "iphone" == a) {
var e = getCookie("__ysuid") || "";
null != window.navigator.userAgent.match(/iphone/i) && (b = "youku://play?vid=" + c + "&source=mplaypage&cookieid=" + e);
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
from optparse import OptionParser
config_path = '/etc/switch-host/'
default_backup_file = 'default-hosts'
{"sig":"67c14a986845f909cc3d62f720522ec28599acb04019c1474e9041616568bc1245b6d8ee5ec2e197c7a902c9b774d83dc0f758307e4cc737c59e248e93bb85a21","msghash":"0348391951533f74f4bcd46cad09a5b30e91e241e6e40eb7a0930039df4a1af4"}
@VeryCB
VeryCB / pev.py
Last active December 23, 2020 13:53
Monitor PEV prices in different pools
import requests
PEV_CONTRACT_ADDRESS = 'TUJrRXdbkHbKEVT8sRs9xdfsaEWe1XHEMC'
PEARL_CONTRACT_ADDRESS = 'TJydMBnDJUYccpBPbLqn6oBxaiaCAhxcFd'
TAI_CONTRACT_ADDRESS = 'TSdDVvLdt3Vu9TqyEH5m273pJxbpJoqAwR'
SAN_CONTRACT_ADDRESS = 'TUU9vEMbEndY4VBm6C6T35EHByvkaMQypc'
TOKEN_SYMBOLS = ['USDT', 'PEARL', 'TAI', 'SAN']
import requests
COLA_TRX_CONTRACT_ADDRESS = 'TKH4HPMPjxR2Q93XBVfQrpGiBpyjBwBG6P'
USDT_TRX_CONTRACT_ADDRESS = 'TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE'
COLA_CONTRACT_ADDRESS = 'TSNWgunSeGUQqBKK4bM31iLw3bn9SBWWTG'
USDT_CONTRACT_ADDRESS = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'
def fetch_token_balances(token_addresses, pair_address):
@VeryCB
VeryCB / pev_new.py
Created October 4, 2020 15:06
Monitor PEV prices in different pools on sSwap
import requests
PEARL_PEV_CONTRACT_ADDRESS = 'TYCmYzi5c2X5FKhUBgD1FtgRCho8aiKd3j'
TAI_PEV_CONTRACT_ADDRESS = 'TNEgrJkG5S1t8p1xqFfqat3LsZaBbKJyVD'
SAN_PEV_CONTRACT_ADDRESS = 'TL5WhUrxfdi8G5WTuDDEB6Ai4GthiZ1jLK'
USDT_PEV_CONTRACT_ADDRESS = 'TSitoyPGTMb6pR3WrWM2jEtCis6b6QJcF1'
USDT_CONTRACT_ADDRESS = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'
PEV_CONTRACT_ADDRESS = 'TQQhxCErnhCQ4XG2fAqP2jG6ZwH5MBFv7X'
PEARL_CONTRACT_ADDRESS = 'TGbu32VEGpS4kDmjrmn5ZZJgUyHQiaweoq'