Skip to content

Instantly share code, notes, and snippets.

View brokosz's full-sized avatar
☁️

Brad Rokosz brokosz

☁️
View GitHub Profile
@brokosz
brokosz / to_taskpaper.scpt
Created December 19, 2025 15:21
JXA script to convert Markdown back to TaskPaper format. Preserves date tags, project tags, and task completion status.
#!/usr/bin/env osascript -l JavaScript
function run(argv) {
const app = Application.currentApplication();
app.includeStandardAdditions = true;
let content;
if (argv.length > 0) {
// Use file from command line
content = app.read(Path(argv[0]));
@brokosz
brokosz / to_markdown.scpt
Created December 19, 2025 15:20
JXA script to convert TaskPaper documents to Markdown format for Obsidian or other needs. Handles projects, tasks, tags, and completion status.
#!/usr/bin/env osascript -l JavaScript
function run(argv) {
const app = Application.currentApplication();
app.includeStandardAdditions = true;
let content;
if (argv.length > 0) {
// Use file from command line
content = app.read(Path(argv[0]));
@brokosz
brokosz / fuzzy dates.scpt
Last active December 15, 2025 03:51
Converts natural language dates to ISO 8601 in TaskPaper 3.9.4. Supports "next Tuesday", "in 3 days", "end of month", etc.
Application('TaskPaper').documents[0].evaluate({
script: `function(editor, options) {
editor.outline.groupUndoAndChanges(function() {
let items = editor.outline.root.descendants;
items.forEach(item => {
let attrs = item.attributes;
for (let attr in attrs) {
let value = attrs[attr];
@brokosz
brokosz / recurring tasks.scpt
Last active December 14, 2025 21:29
Reschedules completed recurring tasks in TaskPaper 3.9.4. Supports daily/weekly/monthly patterns and restores archived projects.
Application('TaskPaper').documents[0].evaluate({
script: `function(editor, options) {
// CONFIGURATION
const REMOVE_COMPLETED_TASK = false; // true = remove old task, false = keep it in archive
let result = {found: 0, processed: 0, tasks: []};
editor.outline.groupUndoAndChanges(function() {
const items = editor.outline.root.descendants;
#!/bin/zsh
# YouTube Stream Aliases
# requires IINA and yt-dlp
# Save as ~/.config/zsh/youtube_streams.zsh or ~/.zsh_youtube_streams
# Then source in ~/.zshrc with: source ~/.config/zsh/youtube_streams.zsh
# Lo-fi Hip Hop streams
alias lofi='iina --music-mode "$(yt-dlp -g --no-warnings "https://www.youtube.com/watch?v=jfKfPfyJRdk")"'
alias chillhop='iina --music-mode "$(yt-dlp -g --no-warnings "https://www.youtube.com/watch?v=5yx6BWlEVcY")"'
alias chill='iina --music-mode "$(yt-dlp -g --no-warnings "https://www.youtube.com/watch?v=28KRPhVzCus")"'
@brokosz
brokosz / New simple file backup command.sh
Created July 2, 2025 02:31
How It Works: 1. First Backup: Creates a simple .bak file (e.g., file.txt → file.txt.bak). 2. Subsequent Backups: Adds a timestamp before .bak to avoid overwriting existing backups (e.g., file.txt → file.txt_20241130_123456.bak). Examples: • First run: bu file.txt Creates: file.txt.bak • Subsequent runs: bu file.txt Creates: file.txt_20241130_12…
bak() {
# If a basic .bak file doesn't exist, create it
if [ ! -e "$1.bak" ]; then
cp "$1" "$1.bak"
else
# Otherwise, create a timestamped backup with .bak at the end
cp "$1" "$1_$(date +%Y%m%d_%H%M%S).bak"
fi
}
@brokosz
brokosz / m4b
Last active June 3, 2025 06:05
#!/bin/bash
# Audio to M4B Audiobook Converter
# Converts multiple audio files per book into single M4B files with metadata
set -e
# Default settings
DEFAULT_BITRATE="copy"
DEFAULT_CHAPTER_LENGTH=300
@brokosz
brokosz / docx2txt.py
Last active April 5, 2025 00:07
Some quick scripts to strip plain text out of common file types to support LLM data collections.
#!/usr/bin/env python3
import sys
from pathlib import Path
try:
from docx import Document
except ImportError:
print("Error: python-docx package not installed.")
print("Install it with: pip install python-docx")
sys.exit(1)
# PopClip - Obsidian daily note
name: Obsidian Daily
icon: iconify:majesticons:note-text-plus-line
options:
- identifier: vault
label: Vault Name
type: string
capture html: true
javascript: |
const vaultName = encodeURIComponent(popclip.options.vault);
@brokosz
brokosz / Obsidian Popclip.yml
Last active December 31, 2024 18:06
Obsidian Popclip Extensions
# PopClip - Obsidian daily note
name: Obsidian Daily
icon: iconify:majesticons:note-text-plus-line
options:
- identifier: vault
label: Vault Name
type: string
capture html: true
javascript: |
const vaultName = encodeURIComponent(popclip.options.vault);