Skip to content

Instantly share code, notes, and snippets.

View miaohf's full-sized avatar
🎯
Focusing

Before Crash miaohf

🎯
Focusing
View GitHub Profile
@miaohf
miaohf / SimpleHTTPServerWithUpload.py
Created April 21, 2022 06:33 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@miaohf
miaohf / wireshark_http_extractor.py
Created December 26, 2020 04:39 — forked from tecoholic/wireshark_http_extractor.py
Extract the flow of requests and responses from a Wireshark dump JSON exported file
import sys
import json
from urllib.parse import urlparse, parse_qs
def parse_multimap(ordered_pairs):
"""JSON loads object_pairs_hook, which creates a list of values when
duplicate keys are found in the JSON file being parsed
@miaohf
miaohf / siecje.py
Created November 19, 2019 14:56 — forked from doobeh/example.html
Checkbox WTForms Example (in Flask)
from flask import Flask, render_template
from flask.ext.wtf import Form, widgets, SelectMultipleField
SECRET_KEY = 'development'
app = Flask(__name__)
app.config.from_object(__name__)
class MultiCheckboxField(SelectMultipleField):
widget = widgets.ListWidget(prefix_label=False)
@miaohf
miaohf / gist:3af2dc3cdee84bd2f021f18fc3712c7d
Created August 4, 2019 08:46 — forked from skyuplam/gist:ffb1b5f12d7ad787f6e4
Flask-Security and Flask-Admin example by Steve Saporata
# Example of combining Flask-Security and Flask-Admin.
# by Steve Saporta
# April 15, 2014
#
# Uses Flask-Security to control access to the application, with "admin" and "end-user" roles.
# Uses Flask-Admin to provide an admin UI for the lists of users and roles.
# SQLAlchemy ORM, Flask-Mail and WTForms are used in supporting roles, as well.
from flask import Flask, render_template
from flask.ext.sqlalchemy import SQLAlchemy
@miaohf
miaohf / ext.py
Created April 6, 2019 12:54 — forked from tonyseek/ext.py
Fixes the nonstandard OAuth interface of Tencent WeChat with Flask-OAuthlib.
from .weixin_compat import fixup_weixin_oauth
oauth = OAuth()
weixin = oauth.remote_app(
'weixin',
app_key='WEIXIN',
request_token_params={'scope': 'snsapi_base'},
base_url='https://api.weixin.qq.com',
authorize_url='https://open.weixin.qq.com/connect/oauth2/authorize',
access_token_url='https://api.weixin.qq.com/sns/oauth2/access_token',