Skip to content

Instantly share code, notes, and snippets.

View avrahamappel's full-sized avatar

Avraham Appel avrahamappel

View GitHub Profile
@avrahamappel
avrahamappel / tabTimer.js
Last active June 3, 2022 17:35
Make browser tab blank after X minutes
(function () { let minutes = parseInt(prompt("How many minutes?", "15")); setTimeout(() => document.body.innerHTML = '', minutes * 60 * 1000); })()
@avrahamappel
avrahamappel / php-macros.vim
Created July 26, 2022 19:49
Some vim macros for PHP
# Boilerplate for PHP class
let @p='i%dawO<?"
onamespaceJ:s~Äku
/wdf\....~AÄkb {}F\s;
class '
# Turn a test name comment into a snake-cased class method (PHPUnit)
let @t=':s#[^/ ]\zs #_#g
^ciwpublic functionA()o{
@avrahamappel
avrahamappel / uri-lati-dl.sh
Last active March 16, 2023 23:25
Download shiur
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p yt-dlp
#
# Download shiur from [Rabbi Uri Lati's YouTube channel](https://www.youtube.com/@UriLati) and convert it into something
# [my phone's podcast player](https://www.kaiostech.com/store/apps/?bundle_id=com.kaiostech.podkast) can use
usage () {
echo "USAGE:"
echo "uri-lati-dl.sh <url>"
}
@avrahamappel
avrahamappel / fatmount.txt
Created March 28, 2023 03:48
Manually mounting FAT32 drive on MacOS Ventura
This is where I mounted my FAT32 USB drive on MacOS Ventura when it didn't want to automatically.
Had to run this command:
```
sudo mount -t msdos <device> ~/fat_mount
```
<device> is obtainable by running
@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) => ({
# 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