Skip to content

Instantly share code, notes, and snippets.

View htlin222's full-sized avatar
🦎

Hsieh-Ting Lin (林協霆) htlin222

🦎
View GitHub Profile

[!note] Page <%= it.pageLabel %>

<%= it.imgEmbed %><%= it.text %> <% if (it.comment) { %>

💬

<%= it.comment %> <% } %>

@htlin222
htlin222 / rearrange_pdf.py
Last active April 17, 2024 13:02
把簡報印成小冊子,時常拿出來蕊,不是一件很快樂的事嗎?
#!/Users/htlin/.pyenv/versions/automator/bin/python
# -*- coding: utf-8 -*-
# title: rearrange_pdf
# author: Hsieh-Ting Lin, the Lizard 🦎
# description: 把簡報印成小冊子,時常拿出來蕊,不是一件很快樂的事嗎?
# date: "2024-04-17"
# --END-- #
"""
把簡報印成小冊子,時常拿出來蕊,不是一件很快樂的事嗎?
@htlin222
htlin222 / click_gui.py
Created April 5, 2024 00:57
自動點擊的魔法
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# title: auto click on my screen
# author: Hsieh-Ting Lin, the Lizard 🦎
# description: 自動點擊的魔法
# date: "2024-04-05"
# --END-- #
import time
@htlin222
htlin222 / pomodoro.sh
Last active March 28, 2024 05:25
an simple pomodoro CLI on macOS
#!/bin/bash
# Author: Hsieh-Ting Lin
# Title: "pomodoro"
# Date: "2024-03-12"
# Version: 1.0.0
# description: "pomodoro, need pipx install termdown"
# 默認參數設置
focus_min=${1:-25}
break_min=${2:-5}
long_break_min=${3:-15}
@htlin222
htlin222 / patient_oop.py
Created February 29, 2024 09:02
A short script to demonstrate object-oriented programming (OOP) in clinical practice
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# title: patient_oop
# description: A short script to demonstrate object-oriented programming (OOP) in clinical practice
# date: "2024-02-29"
# author: Hsieh-Ting Lin, the Lizard 🦎
class Patient:
def __init__(self, age, sex, comorbidities, history, treatments, current_admission):
@htlin222
htlin222 / batch_add_event_from_gsheet_to_gcalendar.gs
Last active March 28, 2024 05:31
batch_add_event_from_gsheet_to_gcalendar
// 當檔案打開時執行
function onOpen() {
var ui = SpreadsheetApp.getUi(); // 獲取當前的用戶界面實例
var menu = ui.createMenu('處理'); // 創建一個新菜單
var calendarDict = getValuesAsDict(); // 從工作表獲取日曆ID和名稱對應關係
var counter = 2; // 計數器,用於生成函式名稱
// 遍歷所有日曆名稱和ID
for (var name in calendarDict) {
@htlin222
htlin222 / rename.sh
Last active March 28, 2024 05:25
rename pdf by pdftotext, and ChatGPT, this script will return something like: 2024-02-06-[journal]-Name_Created_by_ChatGPT
#!/bin/bash
# Author: Hsieh-Ting Lin
# Title: "rename"
# Date: "2024-02-06"
# Version: 1.0.0
# desc: rename by ChatGP
#
# 同目錄下新增一個 .env 檔將 OPENAI_API_KEY=sk-xxxx 放在裡面
# 將.env檔案中的變量加載到當前shell環境中
# set -a # 自動導出變量
@htlin222
htlin222 / chatgpt.R
Created January 30, 2024 11:56
send chatGPT request in R
# desc: send chatGPT request in R
# date: "2024-01-30"
# install.packages("dotenv")
# install.packages("httr")
# install.packages("jsonlite")
send_chatgpt_request <- function(system_message, user_message) {
library(httr)
library(jsonlite)
@htlin222
htlin222 / create_subtitle_for_long_text_by_whisper_api.py
Created January 30, 2024 08:31
Split a long video into small mp3 files, generate .srt files for each mp3, and then merge all content into a single srt file
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# title: generate_subtitle
# date: "2024-01-30"
# description: "Split a long video into small mp3 files, generate .srt files for each mp3, and then merge all content into a single srt file"
# author: Hsieh-Ting Lin, the Lizard 🦎
import argparse
import os
import tempfile
@htlin222
htlin222 / generate_subtitle_zh-TW.py
Last active October 29, 2024 01:14
將一個長影片分割成小的mp3檔後,針對每一個mp3檔產生.srt檔,最後再合併所有內容成一個srt
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# title: generate_subtitle
# date: "2024-01-30"
# description: "將一個長影片分割成小的mp3檔後,針對每一個mp3檔產生.srt檔,最後再合併所有內容成一個srt"
# author: Hsieh-Ting Lin, the Lizard 🦎
import argparse
import os
import tempfile