Skip to content

Instantly share code, notes, and snippets.

View freshwind2004's full-sized avatar

Martin Lee freshwind2004

View GitHub Profile
# 使用方法
# 拷贝语音模型到当前目录下 并命名为 'model'
# 拷贝ffmpeg.exe文件到当前目录下
# 执行 python test_ffmpeg.py speech.mp3 即可
#!/usr/bin/env python3
from vosk import Model, KaldiRecognizer, SetLogLevel
import sys
import os
//JS
<script>
function del(id){
if(confirm("您确认要删除吗?")){
url = '/admin/user/' + id;
data = {
'_token':'{{csrf_token()}}',
'_method':'delete'
};
$.post(
# add spinning loader while page loading
# add following to html header
<style>#loading{position:fixed;z-index:1;width:100%;height:100%;top:0;left:0%;background-color:#ffffff;}.loader{border:10px solid #f3f3f3;border-top:10px solid #5fb1ff;border-radius:50%;width:50px;height:50px;margin:30rem auto 0;animation:spin 2s linear infinite;}@keyframes spin{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}</style>
# add following to html body
<div id="loading"><div class="loader"></div></div>
# add following before html body ends
<script src="jquery.min.js"></script>
pip install python-alipay-sdk
###############################
# settings.py
###############################
# 支付宝
ALIPAY_APP_ID = "2019111669134929"
ALIPAY_DEBUG = False
APP_PRIVATE_KEY_STRING = "-----BEGIN RSA PRIVATE KEY-----\nPRIVATE_KEY_STRING_NO_BREAKS\n-----END RSA PRIVATE KEY-----"
import time
def generate_orderid(user_id):
# 用户id(用0补齐至至少8位)
format_id = str(user_id).zfill(8)
# 当前年月日时分(10位)
daten_n_time = time.strftime('%y%m%d%H%m')
# 当前秒和分秒(4位)
centi_second = str(time.time_ns()).replace('.', '')[-11:-7]
joint = format_id + daten_n_time + centi_second
return joint
# 系统需要安装 gettext
## Linux/Mac
apt-get install gettext
## Windows
下载安装
https://mlocati.github.io/articles/gettext-iconv-windows.html
#################################
/* 表格横置显示 */
@media (max-width: 40rem) {
table.transform {
display: block;
width: 100%;
clear: both;
}
table.transform thead {
float: left;
display: block;
##################################
# views.py
##################################
# 定义分页工具
from django.core.paginator import Paginator
def pagination(queryset, display_num, page_num):
content = Paginator(queryset, display_num).get_page(page_num)
if content.paginator.num_pages <= 5 :
pagerange = list(range(1, content.paginator.num_pages + 1))
{
"log": {
"access": "/var/log/v2ray/access.log",
"error": "/var/log/v2ray/error.log",
"loglevel": "warning"
},
"inbounds": [
//defualt cloudflare 2052 cdn
{
"port": 2052,
# 安装 Gunicorn
pip3 install gunicorn
# 创建 gunicorn systemd
/etc/systemd/system/gunicorn.service:
[Unit]