Skip to content

Instantly share code, notes, and snippets.

View funnyzak's full-sized avatar
🚀
Focusing

Leon funnyzak

🚀
Focusing
  • BeiJing
  • 04:01 (UTC +08:00)
View GitHub Profile
@funnyzak
funnyzak / modify_docker_data_folder.sh
Last active April 11, 2024 14:17
It modifies the Docker data folder to a new location. It is useful if you want to move the Docker data folder to a different drive or partition.
#!/bin/bash
# It modifies the Docker data folder to a new location. It is useful if you want to move the Docker data folder to a different drive or partition.
# Example usage:
# ./modify_docker_data_folder.sh /mnt/docker_data
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'
@funnyzak
funnyzak / watermark.sh
Last active March 16, 2024 11:04
A Bash script for adding a watermark to all image files (.png, .jpg, .jpeg) in a specified directory.
#!/bin/bash
# Check the number of arguments
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <path to watermark image> <search location> <dissolve percentage>"
exit 1
fi
# Path to the watermark image
watermark_path="$1"
@funnyzak
funnyzak / like.js
Created March 15, 2024 06:07
spotify playlist songs with one click like
document.querySelectorAll('[data-testid="add-button"]:not([aria-checked="true"])').forEach(button => button.click());
@funnyzak
funnyzak / objectDeepReplace.js
Created November 29, 2022 02:55
Replace all values of the string type of the object with the target value
objectDeepReplace = (obj, searchRegex, replaceValue) => {
for (const key in obj) {
if (typeof obj[key] === 'string') {
obj[key] = obj[key].replace(searchRegex, replaceValue);
} else if (typeof obj[key] === 'object') {
objectDeepReplace(obj[key], searchRegex, replaceValue);
}
}
return obj;
};
@funnyzak
funnyzak / convert_images_to_heic.sh
Last active April 12, 2022 05:23
Convert images to HEIC
# Iterate through the current folder and convert all JPG|JPEG|PNG|BMP format pictures to HEIC format, delete the original files after success
# 遍历当前文件夹,把所有JPG|JPEG|PNG|BMP格式图片转换为HEIC格式,成功后删除原文件
find -E . -iregex ".*\.(jpg|jpeg|png|bmp)" -print | xargs -n1 -I {} sh -c 'echo "Converting \"{}\" to HEIC." && ((magick mogrify -quiet -format HEIC {} && rm {} && echo "success and deleted {}.") || echo "fail.")'
@funnyzak
funnyzak / bulk delete weibo.js
Created March 14, 2020 23:33
bulk delete weibo
window.onload = (function() {
var timer = setTimeout(Delete, 750);
var item = 0;
function Delete() {
if (item > 65) {
item = 0;
clearTimeout(timer);
return timer = setTimeout(Delete, 15000);
}