Skip to content

Instantly share code, notes, and snippets.

View shisaq's full-sized avatar
🏠
Working from home

Haiquan Li shisaq

🏠
Working from home
View GitHub Profile
@shisaq
shisaq / flask-admin-with-flask-basicauth-login-example.py
Last active May 20, 2024 11:29
flask-admin with flask-basicauth login example(Flask-BasicAuth简单登录Flask-admin后台)
#!/usr/bin/python
# -*- coding: utf-8 -*-
# flask related modules
from flask import Flask, Response
from flask_basicauth import BasicAuth
from flask_admin import Admin
from flask_admin.contrib import sqla
from werkzeug.exceptions import HTTPException
# database set up
{"sig":"74a35da8fff8e8ab67148ff856eab752e83cb6468a4e41c0bce361ef8e9f6c004af1b6633801673284c541e09022c48ab8fd36f46100ecae70527dfd59e5bc000","msghash":"daae049887c7918b2109badf1f7fef5153a0dac11bc068e6b4640896d7089128"}
@shisaq
shisaq / ffmpeg-web-video-guide.md
Created May 31, 2017 03:12 — forked from jaydenseric/ffmpeg-web-video-guide.md
A quick guide to using FFmpeg to create cross-device web videos.

Video conversion with FFmpeg

Install

On mac:

  1. Download the latest release.
  2. Extract the binary and place it in /usr/local/bin.

Command basics

@shisaq
shisaq / css
Created November 26, 2016 20:50
Wechat Markdown CSS
/*
* NOTE:
* - The use of browser-specific styles (-moz-, -webkit-) should be avoided.
* If used, they may not render correctly for people reading the email in
* a different browser than the one from which the email was sent.
* - The use of state-dependent styles (like a:hover) don't work because they
* don't match at the time the styles are made explicit. (In email, styles
* must be explicitly applied to all elements -- stylesheets get stripped.)
*/
@shisaq
shisaq / countdown.js
Last active February 1, 2017 13:37
a simple count down core code
var deadline = "Thu, Feb 22 2017 23:59:59 GMT-0500";
// get the time remaining
function getTimeRemaining(endtime) {
var t = Date.parse(endtime) - Date.parse(new Date());
var seconds = (t / 1000) % 60;
var minutes = Math.floor((t / 1000 / 60) % 60);
var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
var days = Math.floor(t / (1000 * 60 * 60 * 24));
@shisaq
shisaq / rot13cipher.py
Created November 14, 2016 14:10
a simple example to realize "rot13" encode
import webapp2
import cgi
import codecs
# build a simple html form
form = """
<form method="post">
<h1 style="color: green">Let's use rot13 cipher!</h1>
<textarea name="text" rows="8" cols="40">%(text)s</textarea>
<input type="submit">