Skip to content

Instantly share code, notes, and snippets.

View wnma3mz's full-sized avatar
🎯
Focusing

wnma wnma3mz

🎯
Focusing
View GitHub Profile
@wnma3mz
wnma3mz / App.css
Last active July 19, 2020 01:33
react-js-real-time display log
.display-linebreak {
white-space: pre-line;
}
@wnma3mz
wnma3mz / split_word.bas
Created July 19, 2020 01:37
Word split by page
Attribute VB_Name = "模块1"
Option Explicit
Sub DynamicSplitPagesAsDocuments()
Dim oSrcDoc As Document, oNewDoc As Document
Dim strSrcName As String, strNewName As String
Dim oRange As Range
Dim nIndex As Integer, nSubIndex As Integer, nTotalPages As Integer, nBound As Integer
Dim fso As Object
@wnma3mz
wnma3mz / update_ass_time_interval.py
Created July 19, 2020 01:43
ass file update time interval
# coding: utf-8
import os
import datetime
def update_time(dtime, delta_second):
hms, ms = dtime.split('.')
h, m, s = hms.split(':')
delta = datetime.timedelta(seconds=delta_second)
update_dtime = datetime.datetime.strptime(hms, "%H:%M:%S") + delta
@wnma3mz
wnma3mz / win32_keystroke.py
Last active July 19, 2020 01:47 — forked from chriskiehl/Vitual keystroke example
Python win32api simple Vitual keystroke example
# codng: utf-8
import win32api
import win32con
import time
#Giant dictonary to hold key name and VK value
VK_CODE = {'backspace':0x08,
'tab':0x09,
'clear':0x0C,
'enter':0x0D,
# coding: utf-8
import json
import os
import subprocess
import pickle
import time
import base64
import numpy as np
from flask import (Blueprint, Flask, current_app, jsonify, make_response,
request, send_file)
# coding: utf-8
import json
import os
import subprocess
import pickle
import time
import base64
import numpy as np
from flask import (Blueprint, Flask, current_app, jsonify, make_response,
request, send_file)
def cal_PR(TP, FN, FP, TN):
print(TP, FN, FP, TN)
P = TP / (TP + FP)
R = TP / (TP + FN)
Acc = (TP + TN) / (TP + TN + FP + FN)
return Acc, P, R
def count_tfnp(label, output, TN, FP, TP, FN):
@wnma3mz
wnma3mz / app.py
Last active March 18, 2023 09:22
video_flask_stream for gradio
import gradio as gr
from utils import read_image_from_stream
# For Gradio
f = read_image_from_stream()
def func(data):
image = ""
while True:
@wnma3mz
wnma3mz / app.py
Created March 18, 2023 09:27
gradio real-time update text
import gradio as gr
res = [] # It can only be stored in lists.
def generate_text():
for x in range(10):
res.append(str(x))
yield " ".join(res) # Here is to add to the display, not replace it.
yield " ".join(res)
f = generate_text()
@wnma3mz
wnma3mz / slack_requests.py
Created June 10, 2023 08:30
send, command, receive msg from/to claude
import requests
import json
import time
# 创建bot时获取,注:需要在OAuth & Permission中添加若干权限,channels:history,channels:read,channels:write,groups:history,groups:read,groups:write,chat:write, im:history, im:write, mpim:history,mpim:read, mpim:write
token = "" # 固定
# F12 获取
user_token = "" # 固定
header_text = "" # 形如----WebKitFormBoundary********,把*替换正确数值