Skip to content

Instantly share code, notes, and snippets.

View imfht's full-sized avatar
🎯
Focusing

imfht imfht

🎯
Focusing
View GitHub Profile
@imfht
imfht / captcha.py
Created July 3, 2017 11:30 — forked from liberize/captcha.py
简单验证码识别
#!/usr/bin/env python
# coding: utf-8
import os
import sys
from PIL import Image, ImageChops
templates = []
@imfht
imfht / gist:341468d410155b5be35c66acbb103d7f
Created July 27, 2017 09:08 — forked from hest/gist:8798884
Fast SQLAlchemy counting (avoid query.count() subquery)
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()
@imfht
imfht / dnsmasq.conf
Created August 29, 2017 06:34 — forked from aa65535/dnsmasq.conf
dnsmasq config
# 并发查询所有上游DNS服务器
all-servers
# 本地DNS缓存最小有效期
min-cache-ttl=3600
# 本地DNS缓存数目
cache-size=65535
# 上游DNS服务器, 可设置多个
server=8.8.4.4
#server=8.8.8.8
server=114.114.114.114
from flask import Flask
from flask import request
app = Flask(__name__)
from flask import send_file
from selenium import webdriver
import hashlib
from selenium.webdriver.common.keys import Keys
import datetime
@imfht
imfht / ssurt.py
Created November 5, 2017 05:38 — forked from ato/ssurt.py
#!/usr/bin/python3
# coding=utf-8
import re
SSURT_RE = r"""
\A
(?P<scheme> [a-zA-Z] [a-zA-Z0-9+.-]* : )?
(?P<authority>
(?P<slashes> /* )
>>> import urlparse
>>> url = 'http://stackoverflow.com/questions/1234567/blah-blah-blah-blah'
>>> urlparse.urljoin(url, '/')
'http://stackoverflow.com/'
# source: https://stackoverflow.com/a/32214840/8591480
@imfht
imfht / finger.json
Created January 5, 2018 12:58
邮件系统指纹
{
"products": [
{
"name": "eYou",
"banner": {
"http_banner": "亿邮电子邮件系统,亿邮邮件整体解决方案"
}
},
{
"name": "anymacro",
#!/usr/bin/env python
# coding=utf-8
# code by Lucifer
# Date 2017/10/22
import re
import sys
import socket
import base64
import httplib
@imfht
imfht / shoot_test.py
Last active March 17, 2018 12:39
selenium chrome headless add user_agent
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import sys
import uuid
from io import BytesIO
from PIL import Image
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
@imfht
imfht / 1.txt
Created April 3, 2018 07:32
keras lstm demo
This file has been truncated, but you can view the full file.
《白玉老虎》查看《白玉老虎》书评和最新更新以及相关书籍推荐请到《白玉老虎》专题网址http://www.xiaoshuotxt.com/wuxia/1813/
TXT小说天堂 http://www.xiaoshuotxt.net,最有文艺气息的文学网站,提供经典的文学名著、武侠小说、言情小说、人文社科类书籍在线阅读,所有TXT电子书手机免费下载阅读,我们提供给您的小说不求最多,但求最经典最完整
第一部 黄道吉日 第一章 夺命更夫
 小说t-xt天堂   
三月二十七日,大吉。
诸事皆宜。