Skip to content

Instantly share code, notes, and snippets.

@ryanhex53
ryanhex53 / Monitor-NewInvalidSmallBmp.ps1
Created April 12, 2025 08:48
Monitor and delete new invalid BMP files less than 1MB created in the specified directory
<#
.SYNOPSIS
Monitor and delete new invalid BMP files less than 1MB created in the specified directory.
.DESCRIPTION
This script runs in the background, monitoring new .bmp files created in the specified directory and its subdirectories.
If a newly created file is less than 1MB and is determined to be an invalid BMP file,
it will be moved to the recycle bin, and the filename and full path will be output to the console.
.PARAMETER Path
@ryanhex53
ryanhex53 / README.md
Last active October 9, 2024 11:57
Windows screen recording by script only

Windows script for screen recording

Preparation

  • install ffmpeg for convert png to video.

Usage

  1. run screenshot.ps1 powershell to start capture screen into png files.
  2. stop powershell run make.cmd to create mp4 video.
  3. generate-input-list.py optional python code to regenerate duration.txt when you remove some png files.
@ryanhex53
ryanhex53 / README.md
Last active August 8, 2025 07:15
A command tool that use PyPDF2 to merge pdf files

PDF文件合并脚本

将多个PDF文件合并为一个文件,可以指定要合并的页码

用法示例:python3 pdf_merge.py -i file1.pdf,1-3 file2.pdf -o out.pdf

上述指令将file1.pdf13页,file2.pdf的所有页面顺序合并到out.pdf文件中

参数说明

@ryanhex53
ryanhex53 / make_planet.sh
Last active May 1, 2025 15:03
自建 ZeroTier Planet 服务器
#!/bin/bash
# debain ubuntu自动安装zerotier 并设置的为planet服务器
# addr服务器公网ip+port
ip=`wget http://ipecho.net/plain -O - -q ; echo`
addr=$ip/9993
apt autoremove
apt update -y
identity=`cat /var/lib/zerotier-one/identity.public`
echo "identity :$identity=============================================="
@ryanhex53
ryanhex53 / proxy.js
Last active April 28, 2023 14:45
openai api proxy server 反向代理服务器
const http = require('http');
const https = require('https');
const { URL } = require('url');
const PORT = process.env.PORT || 80;
const PROXY_URL = process.env.PROXY_URL || 'https://api.openai.com';
// Create an HTTP proxy server to handle client requests
const server = http.createServer((req, res) => {
// Create a URL object based on the proxy server URL in environment variables
@ryanhex53
ryanhex53 / scan.cmd
Created November 7, 2022 05:30
scan lan ip in windows without install any executable
rem REPLACE 192.168.116 TO YOURSELF SUBNET
ping -4 -n 1 -w 100 192.168.116.1
ping -4 -n 1 -w 100 192.168.116.2
ping -4 -n 1 -w 100 192.168.116.3
ping -4 -n 1 -w 100 192.168.116.4
ping -4 -n 1 -w 100 192.168.116.5
ping -4 -n 1 -w 100 192.168.116.6
ping -4 -n 1 -w 100 192.168.116.7
ping -4 -n 1 -w 100 192.168.116.8
ping -4 -n 1 -w 100 192.168.116.9
@ryanhex53
ryanhex53 / helper.ts
Last active April 30, 2022 08:42
拼音全拼和简拼的判断Typescript或Javascript
const [sm, ym, zt] = [
[
'zh', 'ch', 'sh', 'b', 'p', 'm', 'f', 'd', 't', 'n', 'l',
'g', 'k', 'h', 'j', 'q', 'x', 'r', 'z', 'c', 's', 'y', 'w'
],
[
'ang', 'eng', 'ing', 'ong', 'ai', 'ei', 'ui', 'ao', 'ou', 'iu', 'ie',
'ue', 'er', 'an', 'en', 'in', 'un', 'vn', 'a', 'o', 'e', 'i', 'u', 'v'
],
[
@ryanhex53
ryanhex53 / weread.js
Created April 8, 2022 08:22
微信读书思源宋体
// ==UserScript==
// @name 微信读书网页版使用谷歌思源宋体
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 书籍内容字体修改为谷歌思源宋体,修改标题等字体,更改背景颜色,更改字体颜色。
// @author Ryan
// @match https://weread.qq.com/web/reader/*
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle("@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;700&display=swap');")
@ryanhex53
ryanhex53 / image.py
Created October 13, 2021 07:16
照片视频按年月整理文件夹
#! /usr/bin/python3
from PIL import Image
import os, time, datetime, re, sys
from win32com.propsys import propsys, pscon
def tidy_fies(ignore=False):
d_pat = re.compile(r'(\d{4})[-_]?(\d{2})[-_]?(\d{2})')
f_pat = re.compile(r'^\d{4}-\d{2}$')
@ryanhex53
ryanhex53 / Makefile
Last active August 6, 2021 08:28
ngrok 1.7 android golang cross compile
.PHONY: default server client deps fmt clean all release-all assets client-assets server-assets contributors release-client release-server
export GOPATH:=$(shell pwd)
export GO111MODULE=auto
export NDK=/opt/android-sdk/ndk-bundle
export TOOLCHAIN=${NDK}/toolchains/llvm/prebuilt/linux-x86_64
BUILDTAGS=debug
default: all
deps: assets