diff --git a/raycast/epoch-to-human-date.sh b/raycast/epoch-to-human-date.sh new file mode 100755 index 0000000..316c548 --- /dev/null +++ b/raycast/epoch-to-human-date.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +# Required parameters: +# @raycast.schemaVersion 1 +# @raycast.title Convert Epoch to Human-Readable Date +# @raycast.mode silent +# @raycast.packageName Conversions +# +# Optional parameters: +# @raycast.icon ⏱ +# @raycast.needsConfirmation false +# @raycast.argument1 {"type": "text", "placeholder": "Timestamp Epoch"} +# +# Documentation: +# @raycast.description Convert epoch to human-readable date. +# @raycast.author Siyuan Zhang | d0zingcat +# @raycast.authorURL https://github.com/kastnerorz | https://d0zingcat.dev + +epoch=${1} +size=${#epoch} +if [[ $size == "10" ]]; then + human=$(echo $(date -r $epoch "+%F %T")) + echo -n "$human" | pbcopy +elif [[ $size == "13" ]]; then + human=$(echo $(date -r $(($epoch / 1000)) "+%F %T")) + echo -n "$human" | pbcopy +else + echo 'invalid data(valid length: 10 or 13)' + exit 1 +fi +echo "Converted $epoch to $human" diff --git a/raycast/human-date-to-epoch.sh b/raycast/human-date-to-epoch.sh new file mode 100755 index 0000000..da61719 --- /dev/null +++ b/raycast/human-date-to-epoch.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Required parameters: +# @raycast.schemaVersion 1 +# @raycast.title Convert Human-Readable Date To Epoch +# @raycast.mode silent +# @raycast.packageName Conversions +# +# Optional parameters: +# @raycast.icon ⏱ +# @raycast.needsConfirmation false +# @raycast.argument1 {"type": "text", "placeholder": "Date"} +# +# Documentation: +# @raycast.description Convert human-readable date to timestamp epoch. +# @raycast.author Siyuan Zhang | d0zingcat +# @raycast.authorURL https://github.com/kastnerorz | https://d0zingcat.dev + +date=${1} +length=${#date} +if [[ $length -eq 19 ]]; then + epoch=$(echo $(date -jRuf "%F %T" "$date" "+%s")) + echo -n "$epoch" | pbcopy +elif [[ $length -eq 10 ]]; then + epoch=$(echo $(date -jRuf "%F %T" "$date 00:00:00" "+%s")) + echo -n "$epoch" | pbcopy +elif [[ $length -eq 8 ]]; then + yyyy=$(echo $date | cut -c1-4) + mm=$(echo $date | cut -c5-6) + dd=$(echo $date | cut -c7-8) + epoch=$(echo $(date -jRuf "%F %T" "$yyyy-$mm-$dd 00:00:00" "+%s")) + echo -n "$epoch" | pbcopy +else + echo "Invalid date format." + exit 1 +fi + +echo "Converted $date to $epoch" diff --git a/setup.sh b/setup.sh index dd1f591..0c7452b 100755 --- a/setup.sh +++ b/setup.sh @@ -91,7 +91,7 @@ function recover() { # others git config --global core.excludesfile ~/.config/git/.gitignore - git config --global init.defaultBranch main + git config --global init.defaultBranch main $(brew --prefix)/opt/fzf/install } diff --git a/wezterm/wezterm.lua b/wezterm/wezterm.lua index 8322502..64aceb0 100644 --- a/wezterm/wezterm.lua +++ b/wezterm/wezterm.lua @@ -1,5 +1,6 @@ local wezterm = require('wezterm') return { + default_cwd = wezterm.home_dir .. '/work', font_size = 14, font = wezterm.font_with_fallback({ 'JetBrains Mono',