Skip to content

Instantly share code, notes, and snippets.

@kfatehi
kfatehi / Youtube Shorts Scrubber Bar.js
Created October 28, 2021 03:22
Youtube Shorts Scrubber Bar - Adds back the scrubber bar for youtube shorts
// ==UserScript==
// @name Youtube Shorts Scrubber Bar - Adds back the scrubber bar for youtube shorts
// @namespace Violentmonkey Scripts
// @match https://www.youtube.com/shorts/*
// @grant none
// @version 1.0
// @author -
// @require https://code.jquery.com/jquery-3.6.0.js
// @description 10/27/2021, 8:04:38 PM
// ==/UserScript==
@kfatehi
kfatehi / Dark Wikipedia.js
Last active October 27, 2021 08:08
Dark Wikipedia - Userscript for iOS & macOS Safari
// ==UserScript==
// @name Dark Wikipedia
// @description Darkens Wikipedia on iOS & macOS Safari, for use with https://github.com/quoid/userscripts
// @match https://en.m.wikipedia.org/*
// @match https://en.wikipedia.org/*
// @updateURL
// @version 1.3
// ==/UserScript==
function darkenChrome() {
@kfatehi
kfatehi / Vagrantfile
Created October 24, 2021 08:15
Openpilot 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
kfatehi / Dockerfile
Last active October 13, 2021 04:46
Classic Ruby Dockerfile & Docker Compose
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
kfatehi / new desktop shortcut.lnk
Created March 26, 2020 09:20
windows git bash mintty desktop shortcut into a persistent remote tmux ssh shell session
"C:\Program Files\Git\usr\bin\mintty.exe" -w full -h always /bin/bash -l -e -c 'ssh -t pi@192.168.88.114 tmux new-session -A -s main'
@kfatehi
kfatehi / 1pass_dups.js
Last active December 25, 2023 00:35 — forked from thehesiod/1pass_dups.py
1password duplicate remover (alpha, only run in debugger with breakpoints everywhere *g*)
// you need `op` tool for this, download it here https://support.1password.com/command-line/
// 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');
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}
}, {});
const nvidia = require('./src/nvidia');
const TARGET_TEMP = 69;
let timeouts = [];
let interval = null;
async function autofan(gpus, uuid, tempTarget) {
const tick = async () => {
let gpu_int = gpus[uuid];
@kfatehi
kfatehi / gist:07bdef95c132215598a23caf4ce7c2f5
Created January 6, 2019 03:02
hls to icecast with ffmpeg
set -exuo pipefail
LIVESTREAM_URL=$1
if [[ ! $# -eq 1 ]]; then
echo "usage: $0 <URL>"
exit 1
fi
# Referencing FFMpeg to Icecast2 Streaming Sample Gist: https://gist.github.com/keiya/c8a5cbd4fe2594ddbb3390d9cf7dcac9
URL=$(streamlink $LIVESTREAM_URL worst --stream-url)
channels=2
@kfatehi
kfatehi / PKGBUILD
Last active March 23, 2018 06:30
ripcord PKGBUILD
# Basing this off upwork-appimage.git and gulden-appimage
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=gulden-appimage
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=upwork-appimage
_pkgname=ripcord
_upkgname=Ripcord
pkgname=ripcord-appimage
pkgver=0.2.83
pkgrel=1
pkgdesc="A desktop chat client for Discord (and soon Slack)"
arch=('x86_64')