Skip to content

Instantly share code, notes, and snippets.

@Hu-Wentao
Hu-Wentao / ScriptFlutter.md
Last active January 28, 2026 10:00
Flutter Quick Script.md for Andorid Studio/Intellij IDEA
@Hu-Wentao
Hu-Wentao / AHK-hjkl
Last active December 14, 2024 16:33
AHK-v2 空格+HJKL脚本
; =============================================
; ----- Move -----
Space & h:: {
Send "{Blind}{Left}"
}
Space & j:: {
Send "{Blind}{Down}"
}
Space & k:: {
Send "{Blind}{Up}"
@Hu-Wentao
Hu-Wentao / filepicker.py
Last active December 12, 2024 09:16 — forked from benlansdell/filepicker.py
streamlit: FilePicker
"""
UPDATE: Please see https://github.com/Hu-Wentao/st_tools?tab=readme-ov-file#pathfilefolderselector-st_path_selector
"""
import os
from typing import Callable, Any
import streamlit as st
@Hu-Wentao
Hu-Wentao / st_js.py
Created November 18, 2024 14:11
Streamlit js_eval
from streamlit_js_eval import streamlit_js_eval
def get_timezone(component_key='TZ') -> str:
"""get Timezone
:returns 'Aisa/Shanghai' """
return streamlit_js_eval(
js_expressions=f'Intl.DateTimeFormat().resolvedOptions().timeZone', key=component_key)
@Hu-Wentao
Hu-Wentao / set_logger.py
Created November 16, 2024 18:58
loguru config
def set_logger(log_level: str):
import sys
from loguru import logger
logger.remove()
logger.level(log_level)
logger.add(
sys.stdout,
format='<green>{time:YY-MM-DD HH:mm:ss}</green>| '
'<level>{level}</level>| '
'<cyan>{module}:{function}:{line} ({process}) </cyan>'
@Hu-Wentao
Hu-Wentao / st_tools.py
Last active November 18, 2024 18:37
Streamlit tools, helpers
from typing import Callable, Any
def tool_s_state(update, k: str, init: Callable[[], Any] | Any = None, force_update=False):
"""
:param force_update: force update value, ignore `update` is or not None
:param update: update state value
:param k: st.state_session state key
:param init: init state value or init function
:return: state
@Hu-Wentao
Hu-Wentao / boot_huey_method.py
Created November 12, 2024 14:23
在py程序中, 使用函数而不是命令在新进程中启动huey
import json
import logging
import sys
from huey.bin.huey_consumer import load_huey
from huey.consumer_options import ConsumerConfig
def run_huey(instance_path: str, config: str):
huey_instance = load_huey(instance_path)
@Hu-Wentao
Hu-Wentao / st_add_track.py
Last active November 16, 2024 19:11
Streamlit: inject ms-Clarity 通过修改st源码,为st注入clarity.ms
from bs4 import BeautifulSoup
import pathlib
import shutil
import streamlit as st
CLARITY_SCRIPT = """
<script type="text/javascript">
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
@Hu-Wentao
Hu-Wentao / main.dart
Created February 15, 2023 08:59
divine-vibration-9207
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
print("this is end");
}
@Hu-Wentao
Hu-Wentao / MindBase.md
Last active October 22, 2022 05:48
RFC: MindBase ❤️ TiCloud