Skip to content

Instantly share code, notes, and snippets.

View avrahamappel's full-sized avatar

Avraham Appel avrahamappel

View GitHub Profile
@avrahamappel
avrahamappel / download-masechta.sh
Created January 5, 2026 04:56
Download a full masechta from realcleardaf.com
#!/usr/bin/env nix-shell
#!nix-shell -p curl fd poppler-utils
MASECHTA=${MASECHTA:-yevamos}
DAFIM=${DAFIM:-122}
for daf in {2..$DAFIM}; do
for amud in {a..b}; do
echo "Downloading $MASECHTA daf $daf$amud"
curl --output-dir $MASECHTA -O "https://www.realcleardaf.com/wp-content/uploads/daf/$MASECHTA-$daf$amud.pdf"
ata3.00: exception Emask 0x0 SAct 0x40000 SErr 0x40000 action 0x0
ata3.00: irq_stat 0x40000000
ata3: SError: { CommWake }
ata3.00: failed command: READ FPDMA QUEUED
ata3.00: cmd 60/00:90:30:36:16/01:00:0e:00:00/40 tag 18 ncq dma 131072 in
res 51/40:00:30:36:16/00:01:0e:00:00/40 Emask 0x409 (media error) <F>
ata3.00: status: { DRDY ERR }
ata3.00: error: { UNC }
I/O error, dev sda, sector 236336688 op 0x0:(READ) flags 0x80700 phys_seg 32 prio class 2
ata3.00: exception Emask 0x0 SAct 0x40000 SErr 0x40000 action 0x0
@avrahamappel
avrahamappel / bus-script.py
Last active November 26, 2025 22:45
Get notified when your TSTG bus is almost at your stop
#!/usr/bin/env python3
import json
import math
import os
import requests
from bs4 import BeautifulSoup
# Function to calculate the distance between two latitude/longitude points
@avrahamappel
avrahamappel / convert-screencast-to-gif.sh
Created October 28, 2025 22:01
Convert screencast to GIF
ffmpeg -i INPUT.MOV -vf 'setpts=0.5*PTS,fps=30' OUTPUT.GIF
@avrahamappel
avrahamappel / dl-tat-video.sh
Created April 11, 2025 17:16
Download TorahAnytime video
read url && response=$(curl -s "$(echo $url | sed -E 's@(www\.)?torah@api.torah@')") && video_url=$(echo "$response" | jq -r '.video_url') && title=$(echo "$response" | jq -r '.title') && extension="${video_url##*.}" && filename="${title}.${extension}" && curl "$video_url" -o "$filename"
@avrahamappel
avrahamappel / album.conf
Last active October 31, 2025 15:08
yt-dlp configuration for downloading music with metadata and cover art
# Download in m4a format
--format="ba"
--extract-audio
--audio-format m4a
# Continue downloading if the download failed previously
--continue
--no-overwrites
# Set track number, album name, and artist name metadata tags
@avrahamappel
avrahamappel / get_total_word_count.js
Last active September 6, 2024 18:41
Get total read word count for language
lang = location.pathname.split('/')[1];
await fetch(`https://readlang.com/api/books?language=${lang}&firstLanguage=en&tag=completed`, {
"credentials": "include",
"headers": {
"Accept": "application/json, text/javascript, */*; q=0.01",
"X-Requested-With": "XMLHttpRequest",
},
"referrer": `https://readlang.com/${lang}/library`,
"method": "GET",
"mode": "cors"
@avrahamappel
avrahamappel / get_smallest_story.js
Last active October 9, 2024 16:59
Get the smallest story from ReadLang.com for your current language
(async () => {
lang = location.pathname.split('/')[1];
selects = document.querySelectorAll('.customSelect');
level = `${selects[1].value}-${selects[2].value}`;
document.querySelector('span.customSelect').click();
setTimeout(async () => {
categories = Array.from(document.querySelectorAll('.multiSelectDropdown input')).filter((node) => node.checked).map(node => node.nextSibling.nextSibling.nodeValue).join("|");
bookUrl = await fetch('https://readlang.com/api/books?' + new URLSearchParams({
language: lang,
firstLanguage: 'en',
# Make sure these lines are added to your /etc/zshrc
# Enable Nix daemon
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
source '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
@avrahamappel
avrahamappel / nonograms_starter.js
Last active March 6, 2024 20:53
Nonogram starter
// Calculate the overlap for a single row
const row = (len, nums) => {
let overlap = len - (nums.reduce((a, n) => a + n) + nums.length - 1);
return nums.some((n) => n > overlap) ? overlap : Infinity;
};
// Calculate the overlap for many rows
const rows = (len, rows) =>
rows.map((nums) => ({