Skip to content

Instantly share code, notes, and snippets.

@WaterLemons2k
WaterLemons2k / ie-runner.hta
Created January 14, 2026 15:28
A wrapper used to run Internet Explorer
<head>
<HTA:APPLICATION border="dialog" CONTEXTMENU="no" INNERBORDER="no" maximizeButton="no" minimizeButton="no" scroll="no" singleInstance="yes" />
</head>
<a href="http://example.com">Open Internet Explorer</a>
<script>
location.href = 'about:blank';
close();
</script>
{
"resolution": [
1920,
1080
],
"scrolltime": 12,
"fixtime": 5,
"density": 0,
"customDensity": 50,
"fontname": "Microsoft YaHei",
@WaterLemons2k
WaterLemons2k / video_slow.py
Created July 29, 2025 13:53
Video slow (moviepy 1.0.3)
from moviepy.editor import VideoFileClip
input_path = "input.mp4"
output_path = "output.mp4"
clip = VideoFileClip(input_path)
slow_clip = clip.fx(lambda c: c.speedx(factor=0.5))
# Remove audio to avoid desync
slow_clip = slow_clip.without_audio()
"""
Calculate the average Hex color of colors
"""
colors_hex = [
"#000000",
"#ffffff",
]
from ttkbootstrap import Window
from ttkbootstrap.dialogs import FontDialog
if __name__ == "__main__":
root = Window()
root.geometry("1x1")
root.overrideredirect(True)
fd = FontDialog()
fd.show()
@WaterLemons2k
WaterLemons2k / img-to-dataurl.js
Created June 27, 2025 10:13
Converts an image to Data URL
/**
* Converts an image from {@link src} to a Data URL of {@link type}.
*
* @param {string} src The source URL of the image to convert.
* @param {string} [type] The standard MIME type for the image format to return.
* @returns {Promise<string>} Data URL of the image in the specified type.
* @example
* const dataurl = await imgToDataURL('https://picsum.photos/200', 'image/png');
* console.log(dataurl);
* // Output: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
#!/bin/sh
set -e
SMB_TARGET_DIR=/mnt/z
[ -d $SMB_TARGET_DIR ] || sudo mkdir $SMB_TARGET_DIR
sudo mount -t drvfs Z: $SMB_TARGET_DIR
@WaterLemons2k
WaterLemons2k / vcd.md
Created April 10, 2025 15:01
从 VCD 中提取 MPEG

从 VCD 中提取 MPEG

  1. 打开 UltraISO
  2. 选择 文件(F) -> 打开光盘...
  3. 打开 VCD 后进入 MPEGAV 目录
  4. 选中所有文件,右键选择 提取 MPEG 文件
@WaterLemons2k
WaterLemons2k / ppt.py
Created April 2, 2025 16:24
Replace text fonts in pptx
from pptx import Presentation
def replace_font_in_text_frame(text_frame, old_font, new_font):
for paragraph in text_frame.paragraphs:
for run in paragraph.runs:
if run.font.name == old_font:
run.font.name = new_font
@WaterLemons2k
WaterLemons2k / git-one-commit.sh
Created November 17, 2024 15:40
Make the current commit the only (initial) commit in a Git repo <https://stackoverflow.com/a/15572071>
#!/bin/sh
set -e
# Make the current commit the only (initial) commit in a Git repo
# https://stackoverflow.com/a/15572071
BRANCH=$(git branch --show-current)
NEW_BRANCH="new/$BRANCH"
git branch "$NEW_BRANCH" "$(echo "Initial commit" | git commit-tree "$BRANCH^{tree}")"