Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chsbuffer
chsbuffer / Bench-result.md
Last active July 31, 2025 09:43
Dapper Plus - Bulk Insert Benchmark on SQL Server & SQLite
                                                     SQL Server
╭──────────────────────┬──────────┬─────────────┬───────────────────────────┬────────────────────────────────────────╮
│ Action               │ Entities │ Performance │ TimeFaster                │ ReducedPercent                         │
├──────────────────────┼──────────┼─────────────┼───────────────────────────┼────────────────────────────────────────┤
│ Dapper               │ 2000     │ 1491 ms     │ N/A                       │ N/A                                    │
│ Dapper (Transaction) │ 2000     │ 1370 ms     │ 1.09x faster than Dapper  │ Time reduced by 8% compared to Dapper  │
│ Dapper Plus          │ 2000     │ 63 ms       │ 23.67x faster than Dapper │ Time reduced by 96% compared to Dapper │
╰──────────────────────┴──────────┴─────────────┴───────────────────────────┴────────────────────────────────────────╯
                                                   SQLite :memory:
# 定义常量
$magiskRepo = "C:\a\magisk"
$magiskApk = Resolve-Path "Magisk-v29.0.apk"
$device = "pixel_8_pro"
$AndroidSdkRoot = "C:\Users\$env:UserName\AppData\Local\Android\Sdk"
$sdkmanager = Join-Path $AndroidSdkRoot "cmdline-tools\latest\bin\sdkmanager.bat"
$avdmanager = Join-Path $AndroidSdkRoot "cmdline-tools\latest\bin\avdmanager.bat"
$emulator = Join-Path $AndroidSdkRoot "emulator\emulator.exe"
$adb = Join-Path $AndroidSdkRoot "platform-tools\adb.exe"
@chsbuffer
chsbuffer / hooks_bedrock
Created August 29, 2024 12:41
directory as root archlinux mkinitcpio hook. why? Because I want to install linux and Windows on same partition.
#!/usr/bin/ash
# this file is at /etc/initcpio/hooks/bedrock
run_hook ()
{
mount_handler="ramdisk_mount_handler"
}
ramdisk_mount_handler ()
{
# Windows (mingw-w64-i686) hosted cross toolchains
# AArch64 GNU/Linux target (aarch64-none-linux-gnu)
# 1. Download the ARM GNU Toolchain for Windows host from
# https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
# Extract the downloaded archive to a convenient location, such as C:\bin.
# 2. [optional] You might need to modify the toolchain variable based on
# your extraction location and toolchain version.
# 3. Install MSYS2 (https://www.msys2.org/) if you don't have it already.
# It provides a Unix-like environment for Windows, including package management tools.
@chsbuffer
chsbuffer / InputDialogs.cs
Created June 12, 2024 03:46
C# WinForms InputDialogs (Generated by ChatGPT 4o)
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
public static class InputDialogs
{
public static double getDouble(out bool ok, string title, string label, double value = 0, double min = -2147483647, double max = 2147483647, int decimals = 1, double step = 1, IWin32Window parent = null)
{
double result = value;
# Revanced Script #
Download and Patch Youtube and Youtube Music with latest Revanced assets
prerequisite:
Python ^3.8 in PATH
JRE 17+ in PATH
python-requests ^2.28.1
python-bs4 / beautifulsoup4 ^4.11.1
@chsbuffer
chsbuffer / fixapppaths.ps1
Created October 21, 2022 04:08
Fix uwp apps alias won't start from Run or File Explorer
# https://github.com/microsoft/terminal/issues/7081#issuecomment-1065833836
$WinAppsPaths = @("C:\Program Files\WindowsApps")
$UserAppsPaths = @("$env:LOCALAPPDATA\Microsoft\WindowsApps")
$UserProfile = @("$env:USERPROFILE")
Get-ChildItem "HKCU:\Software\Microsoft\Windows\CurrentVersion\App Paths" | ForEach-Object {
$v = $_.GetValue('')
if (${v}?.StartsWith($WinAppsPaths)) {
$_ | Set-ItemProperty -Name "(default)" -Value "$UserAppsPaths\$($_.PSChildName)"
@chsbuffer
chsbuffer / mqqemoji.ps1
Last active June 30, 2023 03:14
修复 手机QQ、PC QQ_NT 提取的原创表情 GIF
#Requires -Version 7
Set-StrictMode -Version 3.0
# /sdcard/Android/data/com.tencent.mobileqq/tencent/MobileQQ/.emotionsm
$folder = Get-Item ".\emotionsm"
$outFolder = mkdir -Force ".\outfolder"
Get-ChildItem $folder | ForEach-Object -ThrottleLimit 8 -Parallel {
$outFolder = $using:outFolder
@chsbuffer
chsbuffer / gif2tgsticker.ps1
Created August 27, 2022 10:24
GIF to Telegram Video Sticker
# play with filters and arguments to reduce file size lower than 256KB by yourself
$folder = Get-Item ".\gif"
$outFolder = Get-Item ".\outfolder"
Add-Type -AssemblyName System.Drawing
# Get-ChildItem $folder | Sort-Object Length -Descending | Select-Object -First 3 | ForEach-Object -ThrottleLimit 8 -Parallel {
Get-ChildItem $folder | ForEach-Object -ThrottleLimit 4 -Parallel {
$outFolder = $using:outFolder # comment out if Parallel disabled