Skip to content

Instantly share code, notes, and snippets.

Avatar
🐛
Bug fixing

Frost Ming frostming

🐛
Bug fixing
View GitHub Profile
@frostming
frostming / napkin.py
Created Apr 30, 2021
Cusdis Telegram Bot
View napkin.py
from napkin import response, request
import requests
import json
TELEGRAM_BOT_TOKEN = 'xxxxxx'
TELEGRAM_CHAT_ID = 'xxxxx'
def format_message(data):
"""data example:
@frostming
frostming / promise.py
Last active Mar 15, 2021
Python implementation of JavaScript's Promise interface
View promise.py
"""
Python implementation of JavaScript's Promise interface
with the power of asyncio.
See https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise
for the API specification.
Authored by: Frost Ming <mianghong@gmail.com>
License: WTFPL
"""
@frostming
frostming / api.js
Last active Feb 19, 2021
Flask WTF cookie based CSRF
View api.js
// npm i js-cookie --save
import axios from 'axios'
import Cookies from 'js-cookie'
const api = axios.create({
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': Cookies.get('csrf_token')
})
@frostming
frostming / app.py
Last active Sep 7, 2019
Simple Flask APP with Dispatcher
View app.py
import flask
from flask_login import LoginManager, UserMixin, login_user, logout_user
from flask_sqlalchemy import SQLAlchemy
from werkzeug.middleware.dispatcher import DispatcherMiddleware
settings = {
"SECRET_KEY": "hesdfdsfklj;l",
"SQLALCHEMY_DATABASE_URI": "sqlite:///db.sqlite3",
}
View keybase.md

Keybase proof

I hereby claim:

  • I am frostming on github.
  • I am frostming (https://keybase.io/frostming) on keybase.
  • I have a public key whose fingerprint is 1A21 DF26 CF48 7A9B 9E9B C482 7B28 4C8F CC08 5EFF

To claim this, I am signing this object:

@frostming
frostming / README.md
Last active Mar 19, 2019
Simple CORS example with Flask
View README.md

A simple example of CORS & Ajax with Flask

Requirements

$ pipenv install flask flask-cors

Start development server

@frostming
frostming / __init__.py
Created Mar 31, 2018 — forked from nitely/__init__.py
Python Markdown parser
View __init__.py
# -*- coding: utf-8 -*-
# Copyright (c) 2017 by Esteban Castro Borsani.
# Released under MIT license
from .elements import (
Header,
Quote,
HRule,
UListItem,
View MainFrame.py
# Under UIVariables directory
title = "Main Window"