summaryrefslogtreecommitdiff
path: root/ar/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'ar/.local/bin')
-rwxr-xr-xar/.local/bin/fzffiles4
-rwxr-xr-xar/.local/bin/gitupdate7
-rwxr-xr-xar/.local/bin/hugow64
-rwxr-xr-xar/.local/bin/ppts123
-rwxr-xr-xar/.local/bin/remaps7
-rwxr-xr-xar/.local/bin/shortcuts2
-rwxr-xr-xar/.local/bin/statusbar/sb-clock2
-rwxr-xr-xar/.local/bin/statusbar/sb-internet52
-rwxr-xr-xar/.local/bin/statusbar/sb-keyboard4
-rwxr-xr-xar/.local/bin/statusbar/sb-repos2
-rwxr-xr-xar/.local/bin/ylog40
11 files changed, 257 insertions, 50 deletions
diff --git a/ar/.local/bin/fzffiles b/ar/.local/bin/fzffiles
index 44634a2..9f5cd90 100755
--- a/ar/.local/bin/fzffiles
+++ b/ar/.local/bin/fzffiles
@@ -35,7 +35,7 @@ files=$(fzf-tmux \
fi
fi
if [ -d \"\$target\" ]; then
- exa --color=always --long --all --header --icons --git \"\$target\"
+ eza --color=always --long --all --header --icons --git \"\$target\"
elif [ -f \"\$target\" ]; then
bat --color=always --style=header,grid --line-range=:500 \"\$target\"
else
@@ -53,7 +53,7 @@ files=$(fzf-tmux \
--bind "ctrl-g:change-prompt(  )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME/Private/repos $HOME/Public/repos)" \
--bind "ctrl-h:change-prompt( 🏠 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . $HOME)" \
--bind "ctrl-k:change-prompt( 🖥️ )+reload(fd -H -L -t f -E .Trash -E .git -E .cache . ${XDG_DESKTOP_DIR:-${HOME}/Desktop})" \
- --bind "ctrl-r:change-prompt( 👟 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache -E zsh . ${XDG_BIN_HOME:-${HOME}/.local/bin})" \
+ --bind "ctrl-r:change-prompt( 👟 )+reload(fd -H -L -t f -E .Trash -E .git -E .cache -E zsh . ${XDG_SCRIPTS_HOME:-${HOME}/.local/bin})" \
--bind "ctrl-s:change-prompt( 🛠 )+reload(find ${XDG_SOURCES_HOME:-${HOME}/.local/src}/suckless -maxdepth 2 -type f -not -path '*/.git/*')" \
--bind "ctrl-u:change-prompt( 📝 )+reload(if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then top=\$(git rev-parse --show-toplevel 2>/dev/null); git -C \"\$top\" status --porcelain | awk -v root=\"\$top\" '{
staged=substr(\$0,1,1);
diff --git a/ar/.local/bin/gitupdate b/ar/.local/bin/gitupdate
index a2c65ba..6ee163a 100755
--- a/ar/.local/bin/gitupdate
+++ b/ar/.local/bin/gitupdate
@@ -73,7 +73,12 @@ else
# Add and commit changes
git add --all .
git commit -m "$message"
- git pull --rebase origin "$branch"
+ if git remote | grep -qx origin; then
+ remote=origin
+ else
+ remote=$(git remote | head -n 1)
+ fi
+ git pull --rebase "$remote" "$branch"
git remote | xargs -L1 git push --all
fi
diff --git a/ar/.local/bin/hugow b/ar/.local/bin/hugow
index 0460174..13cdf51 100755
--- a/ar/.local/bin/hugow
+++ b/ar/.local/bin/hugow
@@ -2,11 +2,11 @@
set -eu
repodir="$HOME/Private/repos/THESIAH"
-out="$repodir/public/recordings/index.html"
+out="$repodir/public/diary/index.html"
server="${THESIAH_SERVER:-root@thesiah.xyz}"
-dest="/var/www/thesiah/recordings/"
+dest="/var/www/thesiah/diary/"
defaults="sy after foramonth"
-src="$repodir/public/recordings/"
+src="$repodir/public/diary/"
cd "$repodir"
hugo --cleanDestinationDir
@@ -16,35 +16,35 @@ if [ ! -f "$out" ]; then
exit 1
fi
-tmp="$(mktemp "$out.XXXXXXXX.tmp")"
-
-awk -v defaults="$defaults" '
-BEGIN {
- n = split(defaults, a, /[[:space:]]+/)
- insert = ""
- for (i = 1; i <= n; i++) {
- if (a[i] == "") continue
- name = a[i] ".mp4"
- insert = insert \
-" <li>\n" \
-" <a href=\"/recordings/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \
-" </li>\n"
- }
- injected = 0
-}
-{
- print
- if (!injected && $0 ~ /<ul[^>]*id=["'\''"]list["'\''"][^>]*>/) {
- printf("%s", insert)
- injected = 1
- }
-}
-END { if (!injected) exit 2 }
-' "$out" >"$tmp"
-
-mv "$tmp" "$out"
-echo "Injected defaults into: $out"
+# tmp="$(mktemp "$out.XXXXXXXX.tmp")"
+# awk -v defaults="$defaults" '
+# BEGIN {
+# n = split(defaults, a, /[[:space:]]+/)
+# insert = ""
+# for (i = 1; i <= n; i++) {
+# if (a[i] == "") continue
+# name = a[i] ".mp4"
+# insert = insert \
+# " <li>\n" \
+# " <a href=\"/diary/" name "\" data-name=\"" name "\" class=\"vid\">" name "</a>\n" \
+# " </li>\n"
+# }
+# injected = 0
+# }
+# {
+# print
+# if (!injected && $0 ~ /<ul[^>]*id=["'\''"]list["'\''"][^>]*>/) {
+# printf("%s", insert)
+# injected = 1
+# }
+# }
+# END { if (!injected) exit 2 }
+# ' "$out" >"$tmp"
+#
+# mv "$tmp" "$out"
+# echo "Injected defaults into: $out"
+#
ssh "$server" "mkdir -p '$dest'"
if [ -n "${THESIAH_SSH_OPTS:-}" ]; then
@@ -57,7 +57,7 @@ else
fi
if [ -n "${1-}" ]; then
- new="$repodir/content/recordings/$1"
+ new="$repodir/content/diary/$1"
if [ -f "$new" ]; then
rsync -az --update "$new" "$server:$dest"
elif [ -d "$new" ]; then
diff --git a/ar/.local/bin/ppts b/ar/.local/bin/ppts
new file mode 100755
index 0000000..e315367
--- /dev/null
+++ b/ar/.local/bin/ppts
@@ -0,0 +1,123 @@
+#!/bin/sh
+
+# Auto workflow script for git push with content/ directory handling
+# Usage: ppts
+# Automatically: git add ., commit without content/, push to origin, then add content/ and push to home
+
+# Always cd to THESIAH repository
+THESIAH_REPO="${THESIAH_WWW:-${HOME}/Private/repos/THESIAH}"
+
+if [ ! -d "$THESIAH_REPO" ]; then
+ echo "Error: THESIAH repository not found at $THESIAH_REPO"
+ exit 1
+fi
+cd "$THESIAH_REPO" || exit 1
+
+# Verify this is the correct git repository
+if ! git rev-parse --git-dir >/dev/null 2>&1; then
+ echo "Error: Not a git repository at $THESIAH_REPO"
+ exit 1
+fi
+
+# If no arguments, run auto workflow
+if [ -z "$1" ]; then
+ echo "Running auto workflow..."
+
+ # Step 0: Stage all changes first
+ echo "Step 0: Staging all changes..."
+ git add .
+
+ # Check if there are any changes to commit
+ if git diff --quiet && git diff --cached --quiet; then
+ echo "No changes to commit"
+ exit 0
+ fi
+
+ # Step 1: Unstage content/ from staging
+ echo "Step 1: Excluding content/ from staging..."
+ git reset content/ 2>/dev/null || true
+
+ # Check if there are changes to commit (excluding content/)
+ has_changes_without_content=false
+ if ! git diff --cached --quiet; then
+ has_changes_without_content=true
+ fi
+
+ # Check if content/ has changes
+ has_content_changes=false
+ if [ -d "content/" ]; then
+ # Check for untracked files in content/
+ if [ -n "$(git ls-files --others --exclude-standard content/ 2>/dev/null)" ]; then
+ has_content_changes=true
+ fi
+ # Check for modified tracked files in content/
+ if ! git diff --quiet content/ 2>/dev/null; then
+ has_content_changes=true
+ fi
+ # Check for staged changes in content/
+ if ! git diff --cached --quiet content/ 2>/dev/null; then
+ has_content_changes=true
+ fi
+ fi
+
+ # Step 2: Commit without content/ if there are changes
+ if [ "$has_changes_without_content" = true ]; then
+ echo "Step 2: Committing changes (without content/)..."
+ git commit -m "Update (without content/)" || exit 1
+
+ # Step 3: Push to origin (without content/)
+ echo "Step 3: Pushing to origin (without content/)..."
+ # Temporarily disable pre-push hook since we already excluded content/
+ hook_disabled=false
+ if [ -f .git/hooks/pre-push ]; then
+ mv .git/hooks/pre-push .git/hooks/pre-push.disabled
+ hook_disabled=true
+ fi
+ # Try normal push first
+ if git push origin master 2>/dev/null; then
+ # Push succeeded
+ :
+ else
+ # Push failed, try force push (origin may have diverged)
+ echo "Warning: Origin has diverged, using force push..."
+ git push origin master --force || {
+ # Restore hook if push failed
+ if [ "$hook_disabled" = true ] && [ -f .git/hooks/pre-push.disabled ]; then
+ mv .git/hooks/pre-push.disabled .git/hooks/pre-push
+ fi
+ exit 1
+ }
+ fi
+ # Restore hook after successful push
+ if [ "$hook_disabled" = true ] && [ -f .git/hooks/pre-push.disabled ]; then
+ mv .git/hooks/pre-push.disabled .git/hooks/pre-push
+ fi
+ echo "✓ Pushed to origin (without content/)"
+ else
+ echo "No changes to commit (excluding content/)"
+ fi
+
+ # Step 4: Add and commit content/ if there are changes
+ if [ "$has_content_changes" = true ]; then
+ echo "Step 4: Adding content/..."
+ git add content/
+
+ echo "Step 5: Committing content/..."
+ git commit -m "Update content/" || exit 1
+
+ # Step 6: Push to home (with content/)"
+ echo "Step 6: Pushing to home (with content/)..."
+ git push home master || exit 1
+ echo "✓ Pushed to home (with content/)"
+ else
+ echo "No content/ changes to commit"
+ fi
+
+ echo "Auto workflow completed!"
+ exit 0
+fi
+
+# If arguments provided, show usage
+echo "Usage: ppts"
+echo " Run without arguments to execute auto workflow"
+exit 1
diff --git a/ar/.local/bin/remaps b/ar/.local/bin/remaps
index 93832ea..580076d 100755
--- a/ar/.local/bin/remaps
+++ b/ar/.local/bin/remaps
@@ -10,6 +10,10 @@ xinput list | grep 'id=' | while read -r line; do
mouse=$(echo "$line" | grep -i '.*id.*pointer' | sed 's/.*id=\([0-9]\+\).*/\1/')
[ -z "$keyboard" ] || {
case "$(echo "$line" | grep -oE '.*id=' | sed 's/ id=.*//')" in
+ *"Lenovo TrackPoint Keyboard II"*)
+ setxkbmap -device "$keyboard" -option
+ setxkbmap -device "$keyboard" -option caps:ctrl_modifier,altwin:menu_win,altwin:swap_lalt_lwin
+ ;;
*"Lite-On Tech Lenovo USB Travel Keyboard with Ultra Nav"*)
setxkbmap -device "$keyboard" -option
setxkbmap -device "$keyboard" -option caps:ctrl_modifier,ctrl:swap_lwin_lctl
@@ -43,6 +47,9 @@ xinput list | grep 'id=' | while read -r line; do
*"SynPS/2 Synaptics TouchPad"*)
xinput set-prop "$mouse" "libinput Tapping Enabled" 0
;;
+ *"Lenovo TrackPoint Keyboard II"*)
+ [ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 5, 0, 0, 0, 5, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
+ ;;
*"Lite-On Tech Lenovo USB Travel Keyboard with Ultra Nav Mouse"*)
[ -z "$1" ] && xinput set-prop "$mouse" "Coordinate Transformation Matrix" 5, 0, 0, 0, 5, 0, 0, 0, 1 || xinput set-prop "$mouse" "Coordinate Transformation Matrix" $1, 0, 0, 0, $1, 0, 0, 0, 1
xinput set-prop "$mouse" "libinput Scroll Method Enabled" 0, 0, 1
diff --git a/ar/.local/bin/shortcuts b/ar/.local/bin/shortcuts
index af4ad58..e131ce4 100755
--- a/ar/.local/bin/shortcuts
+++ b/ar/.local/bin/shortcuts
@@ -18,7 +18,7 @@ else
yazi_shortcuts_tmp="/dev/null"
fi
command -v ranger && ranger_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/ranger/shortcuts.conf" || ranger_shortcuts="/dev/null"
-command -v qutebrowser && qute_shortcuts="$HOME/.qutebrowser/shortcuts.py" || qute_shortcuts="/dev/null"
+command -v qutebrowser && qute_shortcuts="$HOME/.config/qutebrowser/shortcuts.py" || qute_shortcuts="/dev/null"
command -v fish && fish_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/fish/shortcuts.fish" || fish_shortcuts="/dev/null"
command -v vifm && vifm_shortcuts="${XDG_CONFIG_HOME:-${HOME}/.config}/vifm/shortcuts.rc" || vifm_shortcuts="/dev/null"
diff --git a/ar/.local/bin/statusbar/sb-clock b/ar/.local/bin/statusbar/sb-clock
index a5992a5..d909326 100755
--- a/ar/.local/bin/statusbar/sb-clock
+++ b/ar/.local/bin/statusbar/sb-clock
@@ -1,7 +1,7 @@
#!/bin/sh
# Get current hour and minute
-calendar="🗓️"
+calendar="🗓"
hour=$(date '+%I')
minute=$(date '+%M')
diff --git a/ar/.local/bin/statusbar/sb-internet b/ar/.local/bin/statusbar/sb-internet
index df43676..baa5ebd 100755
--- a/ar/.local/bin/statusbar/sb-internet
+++ b/ar/.local/bin/statusbar/sb-internet
@@ -4,34 +4,74 @@
# Show 🌐 if connected to ethernet or ❎ if none.
# Show 🛰️ if a vpn connection is active
+eth_con="$(nmcli -t -f NAME,TYPE,DEVICE connection show |
+ awk -F: '$2=="ethernet" && $3!="" { print $1; exit }')"
+
+wifi_con="$(nmcli -t -f NAME,TYPE connection show |
+ awk -F: '$2=="wifi" { print $1; exit }')"
+
+if [ -n "$eth_con" ]; then
+ nmcli connection modify "$eth_con" ipv4.method auto
+ nmcli connection modify "$eth_con" ipv4.never-default no
+ nmcli connection modify "$eth_con" ipv4.dns-priority -42
+ nmcli connection modify "$eth_con" ipv4.route-metric 100
+ nmcli connection modify "$eth_con" connection.autoconnect yes
+fi
+
+if [ -n "$wifi_con" ]; then
+ nmcli connection modify "$wifi_con" ipv4.dns-priority 100
+ nmcli connection modify "$wifi_con" ipv4.route-metric 600
+fi
+
case $BLOCK_BUTTON in
1)
"$TERMINAL" -e nmtui
pkill -RTMIN+7 dwmblocks
;;
+2)
+ wifi_dev="$(nmcli -t -f DEVICE,TYPE device |
+ awk -F: '$2=="wifi" { print $1; exit }')"
+
+ wifi_state="$(nmcli -t -f DEVICE,STATE device |
+ awk -F: -v dev="$wifi_dev" '$1==dev { print $2 }')"
+
+ if [ "$wifi_state" = "connected" ]; then
+ nmcli radio wifi off
+ notify-send "Wi-Fi" "Wi-Fi disconnected"
+ else
+ nmcli radio wifi on
+ notify-send "Wi-Fi" "Wi-Fi connected"
+ fi
+
+ pkill -RTMIN+7 dwmblocks
+ ;;
3) notify-send "🌐 Internet module" "\- Left click to connect
❌: wifi disabled
📡: no wifi connection
🛜: wifi connection with quality
❎: no ethernet
🌐: ethernet working
-🛰️: vpn is active
+🛰: vpn is active
" ;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
# Wifi
-if grep -q 'up' /sys/class/net/w*/operstate; then
- wifiicon="$(awk '/^\s*w/ { print "🛜" int($3 * 100 / 70) "%" }' /proc/net/wireless)"
-elif grep -q 'down' /sys/class/net/w*/operstate; then
- grep -q '0x1003' /sys/class/net/w*/flags && wifiicon="📡" || wifiicon="❌"
+if grep -q 'up' /sys/class/net/w*/operstate 2>/dev/null; then
+ if grep -q '^\s*w' /proc/net/wireless; then
+ wifiicon="$(awk '/^\s*w/ { print "🛜" int($3 * 100 / 70) "%" }' /proc/net/wireless)"
+ else
+ wifiicon="📡"
+ fi
+elif grep -q 'down' /sys/class/net/w*/operstate 2>/dev/null; then
+ wifiicon="❌"
fi
# Ethernet
grep -q 'up' /sys/class/net/e*/operstate && ethericon="🌐" || ethericon="❎"
# TUN
-[ -n "$(cat /sys/class/net/tun*/operstate 2>/dev/null)" ] && tunicon="🛰️"
+grep -q 'up' /sys/class/net/tun*/operstate 2>/dev/null && tunicon="🛰"
icons=""
[ -n "$wifiicon" ] && icons="${icons}$wifiicon "
diff --git a/ar/.local/bin/statusbar/sb-keyboard b/ar/.local/bin/statusbar/sb-keyboard
index 34fa2bc..67b5f6d 100755
--- a/ar/.local/bin/statusbar/sb-keyboard
+++ b/ar/.local/bin/statusbar/sb-keyboard
@@ -5,7 +5,7 @@
case $BLOCK_BUTTON in
1) fcitx5-remote -t && kill -44 "$(pidof "${STATUSBAR:-dwmblocks}")" ;;
2) remaps ;;
-3) notify-send "⌨️ Input Method module" "\- Shows current input method (defalt US)
+3) notify-send "⌨ Input Method module" "\- Shows current input method (defalt US)
- Left click to switch language (EN/KO)
- Middle click to change keyboard" ;;
6) setsid -f "$TERMINAL" -e "$EDITOR" "$0" ;;
@@ -28,4 +28,4 @@ hangul) lang="KO" ;;
*) lang="??" ;;
esac
-echo "⌨️$lang"
+echo "⌨$lang"
diff --git a/ar/.local/bin/statusbar/sb-repos b/ar/.local/bin/statusbar/sb-repos
index 2c259ba..d5acfac 100755
--- a/ar/.local/bin/statusbar/sb-repos
+++ b/ar/.local/bin/statusbar/sb-repos
@@ -9,7 +9,7 @@ private_repos="$HOME/Private/repos"
public_repos="${XDG_PUBLICSHARE_DIR:-${HOME}/Public}/repos"
# Icon indicators
-dotfiles_icon="⚙️"
+dotfiles_icon="⚙"
suckless_icon="🛠"
private_icon="🏠"
public_icon="🏢"
diff --git a/ar/.local/bin/ylog b/ar/.local/bin/ylog
index 254803b..c56df36 100755
--- a/ar/.local/bin/ylog
+++ b/ar/.local/bin/ylog
@@ -5,7 +5,7 @@ LOG_DIR="/var/log/nginx"
TARGET="all" # "all" means no target filter (show all lines)
COUNTRY="all" # all|kr|us
-SCOPE="all" # all|access|recordings
+SCOPE="all" # all|access|recordings|hidden|diary|peertube
EXCL_FIREFOX=0 # 1 = exclude Firefox lines by default
EXCLUDES="59.19.56.8" # default exclude pattern
ADD_EXCLUDES=""
@@ -24,13 +24,16 @@ Options:
-c COUNTRY Select country logs (default: all)
all : all logs
- kr : recordings.kr.log + recordings.access.log
- us : recordings.us.log + recordings.access.log
+ kr : recordings.kr.log + recordings.access.log (and diary.kr.log when -s diary)
+ us : recordings.us.log + recordings.access.log (and diary.us.log when -s diary)
-s SCOPE Select log scope (default: all)
- all : recordings + access
+ all : recordings + access + hidden + diary + peertube
recordings : recordings.* logs only
access : access.* logs only
+ hidden : hidden.access.* logs only
+ diary : diary.* logs only
+ peertube : peertube.* logs only
-n Disable Firefox exclusion (by default, Firefox lines are excluded)
@@ -51,7 +54,10 @@ Options:
Examples:
ylog # All logs, last 10 lines each
ylog -s recordings # Recordings logs only, last 10 lines each
+ ylog -s diary # Diary logs only, last 10 lines each
+ ylog -s peertube # Peertube logs only, last 10 lines each
ylog -c kr -t 1.2.3.4 # Search specific IP in Korean logs
+ ylog -c kr -s diary # Korean diary logs only
ylog -t all -l 50 # All logs, last 50 lines each
ylog -d 1 # Logs from 1 day ago only
ylog -d ~2 # Logs from 2 days ago to today
@@ -119,6 +125,32 @@ pick_files() {
[ -e "$q" ] && printf "%s\n" "$q"
done
fi
+ # diary logs: similar structure to recordings
+ if [ "$SCOPE" = "diary" ] || [ "$SCOPE" = "all" ]; then
+ if [ "$COUNTRY" = "all" ]; then
+ for q in "$LOG_DIR/diary.access.log" "$LOG_DIR/diary.access.log".*; do
+ [ -e "$q" ] && printf "%s\n" "$q"
+ done
+ fi
+ case "$COUNTRY" in
+ kr) for q in "$LOG_DIR/diary.kr.log" "$LOG_DIR/diary.kr.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;;
+ us) for q in "$LOG_DIR/diary.us.log" "$LOG_DIR/diary.us.log".*; do [ -e "$q" ] && printf "%s\n" "$q"; done ;;
+ all)
+ for p in diary.kr.log diary.us.log; do
+ for q in "$LOG_DIR/$p" "$LOG_DIR/$p".*; do [ -e "$q" ] && printf "%s\n" "$q"; done
+ done
+ ;;
+ esac
+ fi
+ # peertube logs
+ if [ "$SCOPE" = "peertube" ] || [ "$SCOPE" = "all" ]; then
+ for q in "$LOG_DIR/peertube.access.log" "$LOG_DIR/peertube.access.log".*; do
+ [ -e "$q" ] && printf "%s\n" "$q"
+ done
+ for q in "$LOG_DIR/peertube.error.log" "$LOG_DIR/peertube.error.log".*; do
+ [ -e "$q" ] && printf "%s\n" "$q"
+ done
+ fi
}
# build exclude regex