Skip to content

Instantly share code, notes, and snippets.

View BoringCat's full-sized avatar
🔨

BoringCat

🔨
  • Shadow Legion
  • Dark Obelisk, Shakuras, Koprulu Sector
View GitHub Profile
@BoringCat
BoringCat / get_token_from_share.py
Created February 14, 2025 15:20
从共享会话中获取Token消耗数据
"""
title: 统计函数
author: BoringCat
version: 0.1
"""
from pydantic import BaseModel, Field
from typing import Optional
import asyncio
import httpx
@BoringCat
BoringCat / lock-with-mute.sh
Created August 1, 2025 01:54
Trigger 'Do Not Disturb' before session locked
#!/bin/sh
set -e
function isMute() {
local result=`/usr/bin/dbus-send --session --print-reply=literal\
--dest=org.freedesktop.Notifications --type=method_call\
/org/freedesktop/Notifications\
org.freedesktop.DBus.Properties.Get\
string:'org.freedesktop.Notifications'\
@BoringCat
BoringCat / getFeishuLatestInfo.py
Created October 20, 2025 01:37
获取飞书Linux最新版信息
#!/usr/bin/env python3
import httpx
from pathlib import Path
def getVersionByPlatform(client:httpx.Client, platform:int) -> tuple[str, str, str]:
resp = client.get('/api/package_info', params={'platform': platform})
resp.raise_for_status()
data = resp.json()
download_link = httpx.URL(data['data']['download_link'])
@BoringCat
BoringCat / set-proc-affinity.ps1
Last active October 26, 2025 02:48
设置进程亲和度,指向所有物理核
param(
[Parameter(Position=0, Mandatory=$true, ParameterSetName="process")]
[string]$processName,
[Parameter(Position=1)] # 不取 Win32_Processor,太慢了!
[int]$smtThreads = 2, # 每核心多少个线程
[int]$startId, # 起始ID
[int]$endId, # 结束ID
[switch]$y # 确认
)