Skip to content

Instantly share code, notes, and snippets.

View tofrankie's full-sized avatar
🤯

Frankie tofrankie

🤯
  • UTC+8
  • 09:25 (UTC +08:00)
View GitHub Profile
@tofrankie
tofrankie / fix-sourcetree-icon.sh
Last active April 16, 2026 21:59
Fix Sourcetree icon on macOS
#!/bin/bash
# From: https://jira.atlassian.com/browse/SRCTREE-8221
# Go to the current user's Downloads directory
cd ~/Downloads
# Download a copy of the previous version of Sourcetree
curl -LO 'https://product-downloads.atlassian.com/software/sourcetree/ga/Sourcetree_4.2.16_307.zip'
@tofrankie
tofrankie / remove_duplicate_zsh_history
Last active April 17, 2026 00:26
Remove duplicate entries from macOS zsh history file, keeping only the most recent instance of each command.
#!/usr/bin/env node
/**
* 去重并按时间戳升序排序 zsh_history(支持多行命令记录)
*
* 规则:
* - 以 command(`;` 后面的所有内容,含换行)作为去重 key
* - 保留同 command 的最新 timestamp 的那条记录
* - 最终按 timestamp 升序输出(timestamp 相同按出现顺序、再按 command 兜底)
*
@tofrankie
tofrankie / gif_info.sh
Created June 1, 2024 12:43
Used to obtain GIF image information
function gifinfo() {
# 检查是否安装了 ImageMagick
if ! command -v identify &>/dev/null; then
echo -e "\033[31mError: ImageMagick is not installed.\033[0m"
return 1
fi
local num_frames=-1
local filename=""