Skip to content

Instantly share code, notes, and snippets.

View tris's full-sized avatar

Tristan Horn tris

  • San Francisco, CA
  • 01:13 (UTC -08:00)
View GitHub Profile
@yrro
yrro / backup.py
Last active February 7, 2026 00:51
Orchestrate backups via borgbackup
#!/usr/bin/python3
# Usage: 'backup' alone will back the system up
# 'backup ARGS' will run borg with ARGS, configuring repository location, passphrase etc.
# e.g., 'backup list ::' will list backups in the repository
# Goals: run on RHEL 8's default Python interpreter (3.6) with no non-RHEL packages required
# Non-goals: backing up multiple filesystems, any configurability save modifying values set
# in code.
@KhaosT
KhaosT / Keyboard and Trackpad for Apple Vision Pro.md
Last active December 26, 2025 00:20
Keyboard & Trackpad for Apple Vision Pro

Keyboard & Trackpad for Apple Vision Pro

Photo of a stack of keyboards

Over the last few months, in preparation for Apple Vision Pro, I started a quest to find a good portable keyboard + trackpad setup for the headset. After testing out a wide range of those from the market, here are my findings. Hope it helps people looking for the same.

The impression is based on testing out the keyboard/trackpad with iPadOS, as it shares the similar infrastructure for external input support as visionOS.

After testing on real hardware, visionOS disabled support for any non-Apple trackpad... So feel free to ignore everything about non-Apple trackpad here.

@stek29
stek29 / extract_telegram_macos.ipynb
Last active March 4, 2026 10:00
Extract Telegram messages from db_sqlite PostBox – made for Telegram for macOS, but should work with Telegram for iOS
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cheadrian
cheadrian / Youtube_Livestream_Parts_download.py
Last active August 13, 2024 16:03
Download Youtube Live streamed video from the start or selected time
#With the help of this script you can download parts from the Youtube Video that is live streamed, from start of the stream till the end
import urllib.request
import os
#E.G: "https://r4---sn-gqn-p5ns.googlevideo.com/videoplayback?expire=1603041842& ..... 2.20201016.02.00&sq="
#The sound link should contain: &mime=audio in it.
#Here's an example from NASA LIVE:
#VIDEO: https://r5---sn-gqn-p5ns.googlevideo.com/videoplayback?expire=1603165657&ei=eQmOX8TeFtS07gO1xLWwDA&ip=79.115.11.159&id=DDU-rZs-Ic4.1&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160&source=yt_live_broadcast&requiressl=yes&mh=PU&mm=44%2C29&mn=sn-gqn-p5ns%2Csn-c0q7lnsl&ms=lva%2Crdu&mv=m&mvi=5&pl=20&initcwndbps=1350000&vprv=1&live=1&hang=1&noclen=1&mime=video%2Fmp4&gir=yes&mt=1603143920&fvip=5&keepalive=yes&fexp=23915654&c=WEB&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Clive%2Chang%2Cnoclen%2Cmime%2Cgir&sig=AOq0QJ8wRQIgQMnxy1Yk3HLTpqbOGmjZYH1CXCTNx6u6PgngAVGi4EQCIQDWyaye-u_KGyVQ0HRUsyKVaAzyXbmzDqOGVGpIyP7VtA%3D%3D&lspa
@mrclay
mrclay / flush-iptables.sh
Last active December 2, 2025 18:52
Flush IP tables and restart docker
#!/bin/bash
# Script is needed because my default firewall rules are messed up and after
# every restart, docker containers can't make connections to the host, notably
# preventing debuggers like xdebug from attaching.
# If networking fails in your containers but works in others, rm and re-create the
# docker network that container is bound to.
set -euo pipefail
@dnmfarrell
dnmfarrell / spider.pl
Created January 14, 2019 01:15
Basic Perl spider using Selenium and headless Chrome
#!/usr/bin/env perl
use strict;
use warnings;
use HTTP::Tiny;
use Getopt::Long 'GetOptions';
use Encode qw(encode decode);
use Parallel::ForkManager;
use PerlIO::gzip;
use Selenium::Remote::Driver;
use Time::HiRes 'sleep';
@proger
proger / telegram-macos-message-counts.sh
Last active April 5, 2020 17:50
Count messages by date from Telegram for macOS
# key encoding: https://github.com/peter-iakovlev/Postbox/blob/e9a40ac1b4f73e95187ab293fdd2fc261415de96/Postbox/MessageHistoryTable.swift#L345
# table name: https://github.com/peter-iakovlev/Postbox/blob/e9a40ac1b4f73e95187ab293fdd2fc261415de96/Postbox/Postbox.swift#L1181
sqlite3 ~/Library/Group*/*Telegram*/account*/postbox/db/db_sqlite 'select hex(key) from t7' \
| python3 -c 'import sys, struct, binascii, datetime;
[print(datetime.date.fromtimestamp(struct.unpack(">qiii", binascii.unhexlify(k.strip()))[1]))
for k in sys.stdin]' \
| sort -n | uniq -c
gnuplot \
@glasslion
glasslion / vtt2text.py
Last active November 5, 2025 04:14
This script convert youtube subtitle file(vtt) to plain text.
"""
Convert YouTube subtitles(vtt) to human readable text.
Download only subtitles from YouTube with youtube-dl:
youtube-dl --skip-download --convert-subs vtt <video_url>
Note that default subtitle format provided by YouTube is ass, which is hard
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which
is easier to process.
@AntoineVe
AntoineVe / weather_graph.py
Created May 29, 2017 12:45
Graph data acquired and logged from a RF weather station (Oregon, Otio, ...) via rtl_433
#!/bin/python3
from sys import argv
from pylab import *
import numpy as np
data_file = argv[1]
def col2array(dico, col):
temp_liste = list()
@josby
josby / concat_mp4.sh
Created May 12, 2017 18:38
Concat GoPro Videos with ffmpeg
ffmpeg -f concat -safe 0 -i <(for f in ./*.MP4; do echo "file '$PWD/$f'"; done) -c copy output.MP4