Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
742e5ab
docs: add doc folder and agents.md
rthomazel Mar 24, 2026
3117334
misc(dotfiles/.bashrc): update PUSH_REPOS
rthomazel Mar 25, 2026
44865e4
fix(bin/system-up): simplify mise update
rthomazel Mar 26, 2026
18ace89
fix(bin/download-youtube-id): de-dupe extension
rthomazel Mar 27, 2026
10dd325
feat(aliases): rework jj aliases and functions
rthomazel Mar 28, 2026
4f57102
feat: bin/setup, workflows
rthomazel Mar 28, 2026
ec655ed
fix(bin/setup): allow running as root
rthomazel Mar 28, 2026
42b3fd2
misc: lint and format
rthomazel Mar 28, 2026
e1ac222
misc: update license boilerplate
rthomazel Mar 28, 2026
f1211b6
misc(.gitconfig): update my name
rthomazel Mar 28, 2026
7b7139f
feat(.config/code-oss): go pls options
rthomazel Mar 28, 2026
7a16391
misc(claude): update config
rthomazel Mar 29, 2026
2c1fec5
refactor(dictation-shortcut): use whisper locally
rthomazel Mar 29, 2026
7e70cea
misc(bin/dictation-keyboard-hook): use threading
rthomazel Mar 29, 2026
654ffee
refactor(systemd/dictation-shortcut): use whisper as backend
rthomazel Mar 29, 2026
6e61178
refactor(bin/dictation-keyboard-hook): use xdotool to support latin c…
rthomazel Mar 29, 2026
c4e8d12
fix(bin/dictation-keyboard-hook): weird characters
rthomazel Mar 29, 2026
e8d0e24
refactor(bin/dictation-keyboard-hook): y do tool paste
rthomazel Mar 29, 2026
9051a56
refactor(bin/dictation-keyboard-hook): wl-copy
rthomazel Mar 29, 2026
d5afe69
misc: code review
rthomazel Mar 29, 2026
9bddb52
misc: lintfix
rthomazel Mar 29, 2026
4d1a8bd
misc: fix setup for CI
rthomazel Mar 29, 2026
c68f29a
misc: format
rthomazel Mar 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: shellcheck

on:
pull_request:

jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: install tools
run: bin/setup /usr/local/bin

- name: run shellcheck
run: |
find bin dotfiles -type f -print0 \
| xargs -0 grep -lZE '^#! ?/usr/bin/env bash|^#!/usr/bin/env bash|^#! ?/bin/bash' \
| xargs -0 shellcheck -x
19 changes: 19 additions & 0 deletions .github/workflows/shfmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: shfmt

on:
pull_request:

jobs:
shfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: install tools
run: bin/setup /usr/local/bin

- name: run shfmt
run: |
find bin dotfiles -type f -print0 \
| xargs -0 grep -lZE '^#! ?/usr/bin/env bash|^#!/usr/bin/env bash|^#! ?/bin/bash' \
| xargs -0 shfmt -i 2 -ln bash -d
35 changes: 35 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Agent guidelines for interface -- a personal dotfiles and script repo

## AI Role, behavior, system prompt

We are senior software engineers hacking some shell script together.
I'm reviewing your code and explaining how the codebase is designed.
I'll also give you tasks, directions, we'll be working together so let's have a good time :)
What matters is good design, clean code and reducing maintenance, performance comes second.
See files under doc/ for project structure and documentation (faster than reading the source code)

## Build and Test Commands

Most of the scripts have no tests, we gotta run them to test.

## Code Style

Keep comments short and sweet, don't document obvious code.
**Formatting:** We use `shfmt`.
When moving an alias foo to a function add:
```sh
# todo: remove
unalias foo 2>/dev/null
foo() {
```
this fixes weird bash errors when an alias and a function conflict.
separate functions neatly using #----------------#

## Misc

be more minimalistic: being helpful is good but we need to right answer, avoid guessing or crazy workarounds.
avoid single letter vars if their scope is not small.
when we refactor, minimize renames unless asked for.
run formatter as last step after making code changes.
this is a jujutsu repo and do not make commits.
lib-git-prompt.sh has been vendored and we can modify it.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2018-present, Raphael Thomazella
Copyright (c) 2018-present, R. Thomazella
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion bin/app-inhibit-sleep
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
# Copyright 2025 Raphael Thomazella. All rights reserved.
# Copyright 2025-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand Down
2 changes: 1 addition & 1 deletion bin/btrfs-scrub
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
# Copyright 2024 Raphael Thomazella. All rights reserved.
# Copyright 2024-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand Down
2 changes: 1 addition & 1 deletion bin/bulk-curl-from-file
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2024 Raphael Thomazella. All rights reserved.
# Copyright 2024-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand Down
2 changes: 1 addition & 1 deletion bin/compile-bin
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
# Copyright 2025 Raphael Thomazella. All rights reserved.
# Copyright 2025-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand Down
45 changes: 36 additions & 9 deletions bin/dictation-keyboard-hook
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import sys, evdev, subprocess, time
"""Push-to-talk dictation: record while F2 held, transcribe via whisper-server on release."""
import sys, subprocess, tempfile, os, json, signal
from evdev import InputDevice, categorize, ecodes

if len(sys.argv) != 3:
Expand All @@ -11,13 +12,39 @@ if len(sys.argv) != 3:
key = sys.argv[1]
device = InputDevice(sys.argv[2])

subprocess.Popen(['/usr/bin/nerd-dictation', 'begin', '--numbers-as-digits', "--suspend-on-start", "--simulate-input-tool=YDOTOOL", "--idle-time=0", "--verbose=1"])
SERVER = "http://127.0.0.1:8765/inference"
recording = None

for event in device.read_loop():
if event.type == ecodes.EV_KEY:
k = categorize(event)
if k.keycode == key:
if k.keystate == k.key_down:
subprocess.Popen(['/usr/bin/nerd-dictation', 'resume'])
elif k.keystate == k.key_up:
subprocess.Popen(['/usr/bin/nerd-dictation', 'suspend'])
if event.type != ecodes.EV_KEY:
continue
k = categorize(event)
if k.keycode != key:
continue

if k.keystate == k.key_down and recording is None:
wav = tempfile.mktemp(suffix=".wav")
recording = subprocess.Popen(["pw-record", "--rate=16000", "--channels=1", wav])

elif k.keystate == k.key_up and recording is not None:
recording.send_signal(signal.SIGINT)
recording.wait()
recording = None

result = subprocess.run(
["curl", "-sf", "-F", f"file=@{wav}", SERVER],
capture_output=True, text=True
)
print(result.stderr, end="", flush=True)
print(result.stdout, end="", flush=True)
try:
text = json.loads(result.stdout).get("text", "").strip()
except json.JSONDecodeError:
print(f"whisper-server parse error: {result.stdout}", flush=True)
text = ""
if text:
subprocess.run(["wl-copy", text + " "])
# ctrl+v keycodes, 1 is keydown
subprocess.run(["ydotool", "key", "29:1", "47:1", "47:0", "29:0"])
os.unlink(wav)
wav = None
43 changes: 15 additions & 28 deletions bin/download-youtube-id
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
# Copyright 2024 Raphael Thomazella. All rights reserved.
# Copyright 2024-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand Down Expand Up @@ -83,46 +83,33 @@ prepare_temp() {
}

download() {
local format_id=$1
local format_id=$1 prefix=${2:-}

if [ ! "$format_id" ]; then
return
fi

# downloading big videos can max out /tmp
# ejs:github related to automated captcha challenges using deno
if ! yt-dlp -f "$format_id" "$vid_id" --output "%(title)s-%(release_date)s.%(ext)s" --remote-components ejs:github --paths "temp:/plex/tmp"; then
if ! yt-dlp -f "$format_id" "$vid_id" --output "${prefix}%(title)s-%(release_date)s.%(ext)s" --remote-components ejs:github --paths "temp:/plex/tmp"; then
fatal "$LINENO" "yt-dlp error"
fi
}

prompt_audio_format() {
msgln note: high quality video has no audio, choose audio now
msgln choose an audio format:
msgln "type an audio format <space> extension (ID EXT columns) e.g. 251 webm:"

read -r
audio_fmt="$REPLY"
msgln audio extension: \(see column EXT\)

read -r
audio_ext="$REPLY"
read -r audio_fmt audio_ext
}

prompt_video_format() {
msgln Choose a video format:
msgln 4k: look for mp4 3840x2160
msgln 2k: look for mp4 2560x1440
msgln Leave blank to download only audio

read -r
video_fmt="$REPLY"
msgln "type a video format <space> extension (ID EXT columns) e.g. 137 mp4:"
msgln "4k: look for mp4 3840x2160"
msgln "2k: look for mp4 2560x1440"
msgln "Leave blank to download only audio"

if [ "$video_fmt" ]; then
msgln Video extension: \(see column EXT\)

read -r
video_ext="$REPLY"
fi
read -r video_fmt video_ext
}

validate_formats() {
Expand Down Expand Up @@ -159,7 +146,7 @@ mux() {
# ffmpeg -i ./*."$audio_ext" -i ./*."$video_ext" -crf "$crf" -ac 2 "$name.mp4"

# gpu using va
ffmpeg -vaapi_device /dev/dri/renderD128 -i ./*."$audio_ext" -i ./*."$video_ext" \
ffmpeg -vaapi_device /dev/dri/renderD128 -i ./audio-*."$audio_ext" -i ./video-*."$video_ext" \
-c:v hevc_vaapi -vf format=nv12,hwupload \
-qp "$crf" -ac 2 "$name.mp4"
mv "$name.mp4" "$out_dir"
Expand All @@ -174,7 +161,7 @@ convert_MP3() {
fi

local audio_file
audio_file=$(find . -maxdepth 1 -type f | head -1)
audio_file=$(find . -maxdepth 1 -name "audio-*" -type f | head -1)

if [ ! "$audio_file" ]; then
fatal "$LINENO" "no audio file found"
Expand Down Expand Up @@ -207,8 +194,8 @@ prompt_video_format

validate_formats

download "$audio_fmt"
download "$video_fmt"
download "$audio_fmt" "audio-"
download "$video_fmt" "video-"

mux "$title-$vid_id"
convert_MP3 "$title-$vid_id"
Expand All @@ -218,4 +205,4 @@ cleanup_tmp

cd "$initial_working_dir"

info $LINENO ok "$out_dir/$title-$vid_id.mp4"
log $LINENO ok "$out_dir/$title-$vid_id.mp4"
2 changes: 1 addition & 1 deletion bin/extract
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
# Copyright 2024 Raphael Thomazella. All rights reserved.
# Copyright 2024-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand Down
2 changes: 1 addition & 1 deletion bin/game-audio-fix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
# Copyright 2025 Raphael Thomazella. All rights reserved.
# Copyright 2025-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand Down
4 changes: 2 additions & 2 deletions bin/hue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
# Copyright 2024 Raphael Thomazella. All rights reserved.
# Copyright 2018-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand All @@ -8,7 +8,7 @@
# 🚀 2018 by Thomazella 🌙
# http://tazel.website
# https://github.com/Thomazella
# reviewed by Thomazella on 2024
# reviewed by R. Thomazella on 2024
# main changes were linter fixes and some
# bad var names renamed for clarity
#
Expand Down
2 changes: 1 addition & 1 deletion bin/lazy-git
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
# Copyright 2024 Raphael Thomazella. All rights reserved.
# Copyright 2024-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand Down
4 changes: 2 additions & 2 deletions bin/lazy-jujutsu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! /usr/bin/env bash
# Copyright 2024 Raphael Thomazella. All rights reserved.
# Copyright 2024-present R. Thomazella. All rights reserved.
# Use of this source code is governed by the BSD-3-Clause
# license that can be found in the LICENSE file and online
# at https://opensource.org/license/BSD-3-clause.
Expand Down Expand Up @@ -97,7 +97,7 @@ push() {

debug $LINENO "$base_pwd matches \$PUSH_REPOS"

command jj git push --quiet
command jj git push --quiet
}

### script ###
Expand Down
Loading
Loading