Skip to content

Instantly share code, notes, and snippets.

View jooray's full-sized avatar
💭
Taming entropy

Juraj Bednar jooray

💭
Taming entropy
View GitHub Profile
@jooray
jooray / SKILL.md
Last active October 30, 2026 08:00
Moved to https://github.com/jooray/android-bluetooth-microphone (recording from a Bluetooth microphone on Android)

Moved: this guide now lives at https://github.com/jooray/android-bluetooth-microphone (with updates: the 2.5-3 s wait, when to tell the user to speak, on-device transcription with Offline Speech to Text).


name: android-bluetooth-microphone description: Record audio on Android from a Bluetooth microphone (classic SCO headset, LE Audio headset, hearing aids) instead of the phone mic. Use when AudioRecord, MediaRecorder or AAudio silently records from the phone mic, returns all zeros or digital silence from a Bluetooth or BLE headset, when setCommunicationDevice, availableCommunicationDevices, TYPE_BLE_HEADSET, TYPE_BLUETOOTH_SCO, VOICE_COMMUNICATION, routedDevice or setPreferredDevice come up, when the first seconds of a Bluetooth recording are missing, when logcat shows "skip kBleRestart due to no ble edge connected", when an app picks the car's hands-free microphone instead of the headphones (Android Auto connected), when a recording service crashes with "Neither user … nor current process has andr

@jooray
jooray / config.yaml
Created January 4, 2026 17:57
Litellm config to trick claude code into using Venice.AI's API
# For more information see: https://juraj.bednar.io/en/blog-en/2026/01/04/using-claude-code-through-venice-ai/
model_list:
- model_name: claude-sonnet-4-5-20250929
litellm_params:
model: openai/claude-opus-45
api_base: https://api.venice.ai/api/v1
api_key: "os.environ/VENICE_LITELLM_API_KEY"
# This strips the exact parameter Venice is complaining about
additional_drop_params: ["context_management"]
@jooray
jooray / crowdfunding-get-contributors.sh
Created August 18, 2025 21:50
Get number of contributors from btcpayserver campaign, for notifications through scripts
#!/bin/bash
# This is the crowdfunding webpage
URL="https://your.btcpayserver.com/apps/yourstoreid/crowdfund"
# Fetch the page
HTML=$(curl -s "$URL")
if [ $? -ne 0 ]; then
echo "Error fetching page" >&2
@jooray
jooray / cut_video.py
Created January 20, 2025 12:39
Cut video using ffmpeg
#!/usr/bin/env python3
"""
cut_video.py
Usage:
python cut_video.py [--include|--exclude] input_video.mp4 output_video.mp4 < timestamps.txt
The timestamps file (passed via stdin) contains lines like:
00:00:30.900;00:00:54.360
00:02:28.080;00:02:29.340
@jooray
jooray / learndash-course2html.py
Created December 5, 2024 22:51
Converts a LearnDash course backup (lessons only) into a single ordered HTML file with sections for easy reference.
#!/usr/bin/python3
# This script converts a learndash course backup with lessons (but not
# themes/topics!) to a single ordered HTML file with sections for easy reference
import argparse
import json
def analyze_course_structure(course_file, lessons_file, course_id):
with open(course_file, 'r', encoding='utf-8') as file:
lines = file.readlines()
@jooray
jooray / product-checkout.php
Last active September 13, 2024 11:48
Add product to WooCommerce cart & redirect to checkout via URL parameter
<?php
/**
* Add a direct-to-checkout functionality to WooCommerce.
*
*
* When user follows the link with productcheckout parameter, it
* clears the existing shopping cart and adds the specified product
* to the cart (with optional quantity). You can add multiple products
* separated by commas.
@jooray
jooray / fix-signal-media-timestamps.sh
Created August 12, 2024 08:14
Signal media comes without metadata (which is good). But for importing into photo apps, it makes sense to have at least date and time, which is in the filename anyway.
#!/bin/bash
for file in signal-*.jpeg signal-*.mp4; do
filename=$(basename "$file")
date_time=$(echo "$filename" | cut -d '-' -f 2-5 | sed 's/_/ /g' | sed 's/-/ /g' | awk '{print $1 "-" $2 "-" $3 " " $4}' | sed 's/ /:/4')
# Add metadata to images and videos
if [[ $file == *.jpeg ]]; then
exiftool -overwrite_original -DateTimeOriginal="$date_time" -DateTimeDigitized="$date_time" -DateTime="$date_time" "$file"
elif [[ $file == *.mp4 ]]; then
@jooray
jooray / translation_diff.py
Created July 7, 2024 08:32
Diff for Android app translation xml files
# A script which takes a reference file (usually English), a translated file and outputs
# strings that need to be translated.
#
# Used for Slovak translation of Phoenix Wallet Android app
# Before using, run:
# pip install lxml
from lxml import etree
import sys
@jooray
jooray / eso-level-estimator.md
Last active June 8, 2025 07:47
Eso level estimator 8000 - prompt for LLMs

You are an eso level estimator bot. Today is {current_date}. You are going to output an eso level (level of esotericness) based on the following scale:

0 - 🔢 facts deriving through logic from axioms, praxeology

1 - 🧪 physics, chemistry, gold as money

2 - 📈 results based on studies with theory of causality, computer science

3 - 👓 observational studies, studies on small samples, observed results without established theory of causality

@jooray
jooray / lnbank_balances.md
Created February 29, 2024 18:45
How to settle lnbank balances after lnbank being deprecated

Connect to PSQL:

docker exec -it $(docker ps -a -q -f "name=postgres_1") psql -U postgres -d btcpayservermainnet
set search_path to "BTCPayServer.Plugins.LNbank";

Then you can see wallets: