Skip to content

Instantly share code, notes, and snippets.

View htlin222's full-sized avatar
🦎

Hsieh-Ting Lin (林協霆) htlin222

🦎
View GitHub Profile
@htlin222
htlin222 / find_friends.lua
Last active December 31, 2023 06:19
Create backlink in markdown by Lunasnip and Ripgrep
local ls = require("luasnip")
local i = ls.insert_node
local s = ls.snippet
local t = ls.text_node
local f = ls.function_node
local function findFilesWithSameName(_, _, _)
local current_buf = vim.fn.bufname("%")
local current_file_name = vim.fn.fnamemodify(current_buf, ":t:r")
local command_template = [[
@htlin222
htlin222 / batch_convert_epub_to_text.sh
Created December 30, 2023 18:50
use calibre bin ebook-convert to batch convert epub file to text
#!/bin/bash
# Author: Hsieh-Ting Lin
# title: "epubtxt"
# date created: "2023-12-19"
# 設定 EPUB 檔案所在的資料夾
FOLDER="path/to/your/epub/files"
# 設定轉換後的 EPUB 檔案應該移動到的資料夾
EPUB_FOLDER="$FOLDER/epub"
@htlin222
htlin222 / tts_edge.py
Created December 30, 2023 17:51
Generate a mp3 from text file by edge-tts python package (for free 🈚)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# title: tts_openai
# date: "2023-11-09"
# author: Hsieh-Ting Lin, the Lizard 🦎
# import os
import asyncio
import concurrent.futures
import multiprocessing
import os
@htlin222
htlin222 / csv_to_ics.py
Last active March 28, 2024 05:27
Generate ICS file by csv
#!/usr/bin/env python3
import csv
import sys
import pytz
from ics import Calendar, Event
from datetime import datetime, timedelta
# Adjust this to your local timezone
local_timezone = pytz.timezone("Asia/Taipei")
before_minutes = 10 # minutes 行前通知時間
@htlin222
htlin222 / Draft.txt
Last active January 22, 2024 02:34
"醫療之路:年終反思與成長的旅程"
年底了!在這個寧靜的夜晚,我獨自坐在房間內,思緒穿梭於過去一年所做的決定和經歷中。這一年對我而言,既是挑戰也是成長的一年。無論是為了安寧專科考試的準備,還是我向院長提出的長信,亦或是參與院內的智慧幫浦專案,每一件事都帶給我不同的啟發和經驗。
在準備安寧專科考試的過程中,我深刻體會到醫療專業知識的深度和廣度。這不僅是一次考試的準備,更是對自我專業能力的一次深度挖掘和提升。當我最終獲得了安寧專科醫師資格時,那份成就感和自豪感溢於言表。但這僅僅是開始,因為在醫療行業,學習永遠不會停止。
@htlin222
htlin222 / pdf_each_page_to_txt.sh
Created December 20, 2023 13:09
For each pdf page, convert it to a single txt file
#!/bin/bash
# Author: Hsieh-Ting Lin
# Title: "convert_pdf_every_page"
# Date: "2023-12-20"
# Version: 1.0.0
# Notes:
# - `brew install poppler` first for bin/pdftotext
# 檢查命令列參數
if [ $# -ne 1 ]; then
@htlin222
htlin222 / emoji_survival_with_vulcan.sh
Created December 20, 2023 08:42
Live long and prosperous
#!/bin/bash
# Author: Hsieh-Ting Lin
# Title: "emoji_survival_vulcan"
# Date: "2023-12-20"
# Version: 1.0.0
# Notes: Live long and prosperous
# Input argument for the number of Vulcan salute emojis
vulcan_salutes=$1
@htlin222
htlin222 / check_app.sh
Created December 20, 2023 08:30
這個 bash 腳本是用來檢查 Anki 應用程序是否正在運行,如果沒有則啟動它
#!/bin/bash
# title: checkAnki
# date: "2023-12-20"
# 這個 bash 腳本是用來檢查 Anki 應用程序是否正在運行,如果沒有則啟動它
# 首先檢查是否有一個進程包含 "/Applications/Anki.app/Contents/Frameworks",
# 這個路徑是 Anki 應用程序的典型位置。`grep -v grep` 是用來排除搜尋 `grep` 命令本身的結果。
if ! ps aux | grep "/Applications/Anki.app/Contents/Frameworks" | grep -v grep >/dev/null; then
# 如果 Anki 沒有運行,顯示一條消息並啟動 Anki
echo "Anki is not running. Starting Anki..."
@htlin222
htlin222 / emojimont.sh
Created December 15, 2023 12:37
🌕🌕🌕🌕🌕🌕🌖 = 6.8 months
#!/bin/bash
# Author: Hsieh-Ting Lin
# title: "emojimonth"
# date created: "2023-12-15"
# 接受用戶輸入的月份數
input_month=$1
# 確保用戶輸入了參數
if [ -z "$input_month" ]; then
@htlin222
htlin222 / fix_authors_in_zotero.js
Last active November 21, 2023 07:02
In Zotero, when we import a RIS file, there might be too many author in same item, run this code in `Tools`-> `Devloper` -> `Run Javascript` to fix it
var items = await Zotero.Items.getAll(Zotero.Libraries.userLibraryID);
// 遍歷每一個項目
for (let item of items) {
let changed = false;
// 創建一個新的創作者列表
let newCreators = [];
// 遍歷項目中的所有創作者