This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 當檔案打開時執行 | |
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); // 獲取當前的用戶界面實例 | |
var menu = ui.createMenu('處理'); // 創建一個新菜單 | |
var calendarDict = getValuesAsDict(); // 從工作表獲取日曆ID和名稱對應關係 | |
var counter = 2; // 計數器,用於生成函式名稱 | |
// 遍歷所有日曆名稱和ID | |
for (var name in calendarDict) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 # 自動導出變量 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# title: trim | |
# date: "2024-01-29" | |
# description: 此 Python 指令碼可從視訊檔案中根據指定的時間段列表提取多個片段。它接受命令列參數以指定時間段檔案、視訊源和輸出目錄。若輸出目錄不存在,則自動建立。指令碼使用 moviepy 庫處理視訊,並生成以開始時間命名的片段檔案。 | |
# `python trim.py -i clips.csv -v input.mp4` | |
import argparse | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- description: Align Comments in Neovim, ignoring lines that are Markdown hyperlink references | |
-- | |
local vim = vim | |
local augroup = vim.api.nvim_create_augroup -- Create/get autocommand group | |
local autocmd = vim.api.nvim_create_autocmd -- Create autocommand | |
local function align_comments() | |
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) | |
local max_comment_start = 0 | |
local comment_block = {} | |
local new_lines = {} |