#!/usr/bin/env node /** * env-check.js - 系统环境检查工具 * 检查 Node.js 版本、npm/vpn 可用性、全局命令、系统信息等。 */
import process from 'node:process';
import os from 'node:os';
import tty from 'node:tty';
// From: https://github.com/sindresorhus/has-flag/blob/main/index.js
/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {import requests from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry import random import time from typing import Dict, Optional
import asyncio import aiohttp import time import logging from typing import List, Tuple
#!/bin/bash # 系统资源监控与告警脚本 # 监控CPU、内存、磁盘使用率,超过阈值时记录日志并告警 # 配置阈值(百分比) CPU_THRESHOLD=80
// 前端常用工具函数集合
/**
* 防抖函数
* @param {Function} fn 需要执行的函数
* @param {number} delay 延迟时间(毫秒)import sqlite3 import time import random def create_connection(db_name=':memory:'):
import parseMilliseconds from 'parse-ms';
const isZero = value => value === 0 || value === 0n;
const pluralize = (word, count) => (count === 1 || count === 1n) ? word : `${word}s`;
const SECOND_ROUNDING_EPSILON = 0.000_000_1;import re import json import sys from typing import Dict, Any, List, Optional class PromptTemplateEngine:
import process from 'node:process';
import fs from 'node:fs';
import fsPromises from 'node:fs/promises';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
const handlePreserveConsecutiveUppercase = (decamelized, separator) => {
// Lowercase all single uppercase characters. As we
// want to preserve uppercase sequences, we cannot
// simply lowercase the separated string at the end.
// `data_For_USACounties` → `data_for_USACounties`
decamelized = decamelized.replace(# -*- coding: utf-8 -*- """ envoy.core ~~~~~~~~~~
#!/bin/bash # ===================================================== # MySQL 数据库自动备份脚本 # 功能:备份指定数据库,压缩存储,并自动清理过期备份 # 支持:自定义备份目录、保留份数、日志文件 # =====================================================
#!/usr/bin/env node /** * batch-rename - 交互式批量文件重命名工具 * 支持:正则匹配、过滤类型、预览、冲突检测、日志输出 */
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>CSS 卡片网格动画</title>
# -*- coding: utf-8 -*- """Excel 报表生成:多 sheet + 表头样式 + 自动列宽 + 数据填充 基于 openpyxl,适合导出业务数据报表""" from datetime import datetime from pathlib import Path
/**
* 轻量 hash 路由:路由表 + 参数 + 守卫 + 懒加载
* 不依赖框架,纯原生实现
*/
class HashRouter {
constructor({ routes = [], onError = null, mode = "hash" } = {}) {# -*- coding: utf-8 -*- """文本相似度计算:余弦相似度 + Jaccard + 去停用词 零第三方依赖,中文分词用 jieba(可选),无则按字符切分""" import math import re from collections import Counter
/**
* 表单校验引擎:链式规则 + 多语言错误信息 + 自定义规则
* 用法:new Validator().add('email', v => v.required().email()).validate(data)
*/
class Validator {
constructor() {# -*- coding: utf-8 -*- """函数结果缓存装饰器:LRU + TTL + 可选磁盘持久化 适合缓存数据库查询 / API 结果 / 重计算""" import functools import hashlib import json