Skip to content

Instantly share code, notes, and snippets.

kfatehi /
Created Apr 17, 2022
Rebroadcast (transcode) the audio of a video livestream over Icecast.
# You can use streamlink to extract the stream URL, e.g.:
# PL_URL=$(streamlink --stream-url https://livestream-website-url best)
# Generally figured out from this gist...
while ! curl -s $PL_URL | grep -q offline; do
kfatehi / global-video-shortcuts-userscript.js
Last active Mar 13, 2022
Global Video Shortcuts Userscript
View global-video-shortcuts-userscript.js
// ==UserScript==
// @name Global Video Shortcuts
// @namespace Violentmonkey Scripts
// @match *://*/*
// @grant none
// @version 1.0
// @author -
// @description lets you step through videos on any site using youtube's keyboard shortcut design
// ==/UserScript==
View gist:2022a0aba0f61708ff72df20a18dfd72
docker run --name timescaledb -t timescale/timescaledb:latest-pg12 -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass -e POSTGRES_DB=db -p 5432:5432
docker run --name grafana -t grafana/grafana:7.5.6 -p 3000:3000
now you can visit port 3000 and add a datasource using the credentials
kfatehi / Youtube Shorts Scrubber Bar.js
Created Oct 28, 2021
Youtube Shorts Scrubber Bar - Adds back the scrubber bar for youtube shorts
View Youtube Shorts Scrubber Bar.js
// ==UserScript==
// @name Youtube Shorts Scrubber Bar - Adds back the scrubber bar for youtube shorts
// @namespace Violentmonkey Scripts
// @match*
// @grant none
// @version 1.0
// @author -
// @require
// @description 10/27/2021, 8:04:38 PM
// ==/UserScript==
kfatehi / Dark Wikipedia.js
Last active Oct 27, 2021
Dark Wikipedia - Userscript for iOS & macOS Safari
View Dark Wikipedia.js
// ==UserScript==
// @name Dark Wikipedia
// @description Darkens Wikipedia on iOS & macOS Safari, for use with
// @match*
// @match*
// @updateURL
// @version 1.3
// ==/UserScript==
function darkenChrome() {
kfatehi / Vagrantfile
Created Oct 24, 2021
Openpilot Vagrantfile
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
kfatehi / Dockerfile
Last active Oct 13, 2021
Classic Ruby Dockerfile & Docker Compose
View Dockerfile
FROM ubuntu:20.04
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN useradd -s /usr/bin/bash -d /home/deployer -m deployer
RUN mkdir /app
RUN chown deployer /app
RUN apt-get update && apt-get install -y \
kfatehi / new desktop shortcut.lnk
Created Mar 26, 2020
windows git bash mintty desktop shortcut into a persistent remote tmux ssh shell session
View new desktop shortcut.lnk
"C:\Program Files\Git\usr\bin\mintty.exe" -w full -h always /bin/bash -l -e -c 'ssh -t pi@ tmux new-session -A -s main'
kfatehi / 1pass_dups.js
Last active Nov 23, 2021 — forked from thehesiod/
1password duplicate remover (alpha, only run in debugger with breakpoints everywhere *g*)
View 1pass_dups.js
// you need `op` tool for this, download it here
// create items.json like so:
// op list items | jq > items.json
// then run this script
// this script outputs uuids of dupes as keyed by item title, create, and modified date,
// feed it into the delete command like so:
// node process.js | xargs -I{} op delete item {}
const items = require('./items.json');
View nvidia.js
const { exec } = require('child_process');
const getGPUList = async () => {
return new Promise(function(resolve, reject) {
exec('nvidia-smi -L', (err, stdout, stderr) => {
if (err) return reject(err);
let gpuMap = stdout.trim().split('\n').reduce((acc, line)=>{
let [_, numStr, uuid] = line.match(/GPU (\d+):.+UUID: (.+)\)/)
return {...acc, [uuid]: numStr}
}, {});