Skip to content

Instantly share code, notes, and snippets.

@cash2one
cash2one / douyinsig.py
Created August 22, 2018 15:17 — forked from a232319779/douyinsig.py
douyin checksum calc.
# -*- coding: utf-8 -*-
# @Time : 2017/12/23 16:07
# @Author : ddvv
# @Site :
# @File : douyincore.py
# @Software: PyCharm
import hashlib
class calcSig(object):
@cash2one
cash2one / ubuntu-cli-install-android-sdk.sh
Created September 22, 2017 08:05 — forked from zhy0/ubuntu-cli-install-android-sdk.sh
Install Android SDK on headless Ubuntu linux machine via command line, so that you can compile open source Android apps.
#!/bin/bash
# Thanks to https://gist.github.com/wenzhixin/43cf3ce909c24948c6e7
# Execute this script in your home directory. Lines 17 and 21 will prompt you for a y/n
# Install Oracle JDK 8
add-apt-repository ppa:webupd8team/java
apt-get update
apt-get install -y oracle-java8-installer
apt-get install -y unzip make # NDK stuff
@cash2one
cash2one / wordgen.py
Created August 4, 2017 03:22
Generate passphrases from English words
#! /usr/bin/env python
#
# Usage:
# python wordgen.py
#
# Operation:
# Takes no command like arguments, writes 10 space-separated words then newline to standard
# output. Consider piping to 'less' or another program which will clear the screen on quit.
#
@cash2one
cash2one / watermark.py
Created August 3, 2017 17:08 — forked from simon-liu/watermark.py
python watermark
import os
from PIL import Image, ImageEnhance, ImageDraw, ImageFont
def text2img(text, font_color="Black", font_size=30):
"""生成内容为 TEXT 的水印"""
font = ImageFont.truetype('/Users/liuzenglu/Documents/yahei.ttf', font_size)
# 多行文字处理
text = text.split('\n')
@cash2one
cash2one / pvp.py
Created August 3, 2017 17:06 — forked from Germey/pvp.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2017-05-12 12:31:13
# Project: PVP
from pyspider.libs.base_handler import *
import json
import re
import pymongo
@cash2one
cash2one / wechat_user_permission_check.py
Created August 3, 2017 16:38
wechat small program weapp user permission check, login_required alike
# -*- coding: utf-8 -*-
import hashlib
import os
import json
import urllib2
import time
import logging
from django.utils import timezone
from django.http import JsonResponse
import requests
import json
import pymysql.cursors
import time
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# 禁用安全请求警告
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
connect = pymysql.Connect(host='localhost',
port=3306,
user='root',
@cash2one
cash2one / serverchan.py
Created August 3, 2017 16:13 — forked from liangcha-ck/serverchan.py
server chan client
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import urllib
import urllib2
__version__ = '0.1.0'
__author__ = 'Liang Cha (ckmx945@gmail.com)'
@cash2one
cash2one / weixin_signature.py
Created August 3, 2017 16:10 — forked from Jeanhwea/weixin_signature.py
Generate Wechat Signature in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hashlib
import random
def gen_nonce(length = 16):
base = 'abcdefghijklmnopqrstvuwxyzABCDEFGHIJKLMNOPQRSTVUWXYZ0123456789'
chars = [base[random.randrange(0, len(base))] for _ in xrange(length)]
@cash2one
cash2one / wechat_getappmsgext.py
Created August 3, 2017 15:44 — forked from chen206/wechat_getappmsgext.py
微信公众号文章抓取阅读数和点赞数
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
from urlparse import urlparse, parse_qs
import requests