Skip to content

Instantly share code, notes, and snippets.

View speelbarrow's full-sized avatar
🦾
hustling and/or bustling

Noah Friedman speelbarrow

🦾
hustling and/or bustling
View GitHub Profile
@speelbarrow
speelbarrow / launch.sh
Created June 16, 2024 21:51
Open file in Neovide
# Only tested on macOS, but should work anywhere where you can specify a shell script as the program to open a file with
# On macOS, create an Automator app, then create a "Run Shell Script" step and run this script.
PID=`grep -oE "([0-9]+)\.0$" "$HOME/.neovide" | rev | cut -c3- | rev`
if ps -p $PID > /dev/null; then
command nvim --server `cat $HOME/.neovide` --remote-send "<Cmd>NeovideFocus<CR>"
# Remove the following line if you don't want the file to open in a new tab
command nvim --server `cat $HOME/.neovide` --remote-send "<Cmd>tabnew<CR>"
command nvim --server `cat $HOME/.neovide` --remote-send "<Cmd>lua vim.schedule_wrap(vim.cmd.e)('$1')<CR>"
else
@speelbarrow
speelbarrow / style.css
Created January 12, 2024 17:37
Safari Custom CSS monospace override
/* NOTE: This won't work to override the system monospace font in every context. However, it's better than nothing. */
/* Follow this guide to implement the stylesheet: https://blog.jim-nielsen.com/2021/custom-style-sheet-in-safari/ */
/* Important your custom fonts from Google Fonts or some other online source, due to security policies this will not work if the font is only installed locally. */
code, pre {
font-family: /* Add your custom font family here */ monospace !important;
}
@speelbarrow
speelbarrow / style.css
Last active January 12, 2024 16:59
BetterDiscord monospace override
code, *[class^="inlineCode"] *,*[class^="editor"] * {
font-family: /* Add your custom font family here */ monospace !important;
}
@speelbarrow
speelbarrow / compiles.rs
Created July 3, 2023 17:45
Confusing Rust compiler behaviour
enum Example {
Example1,
Example2,
}
impl Example {
fn Example1() {
println!("Hello, World!");
}
}
@speelbarrow
speelbarrow / docker_desktop.sh
Created May 17, 2023 18:50
Wrapper for 'docker' command on macOS that starts Docker Desktop if it's not already running so that you don't have to
function docker {
if ! command docker info &> /dev/null; then
open -a /Applications/Docker.app
echo -n "Waiting for Docker to start ."
local slept=0
until [ $slept -eq 15 ] || command docker info &> /dev/null; do
sleep 1
((slept++))
echo -n " ."
@speelbarrow
speelbarrow / docker.sh
Last active March 16, 2024 15:59
Docker convenience command extensions
# Source this file!
function docker {
case "$1" in
disposable)
command docker run --rm -it --name disposable ${@[@]:2}
;;
;;
images-grep)
command docker images -a --format 'table {{.Repository}}:{{.Tag}} {{.ID}}' | tail -n +2 | sed -nE "s/^$2.* ([A-z0-9]+)$/\\1/p"
;;
@speelbarrow
speelbarrow / sudo-tid.sh
Last active May 5, 2023 17:03
Enable TouchID for `sudo` on macOS
#!/usr/bin/env bash
# NOTE: This command will have to be run again every time the system is updated
if ! (sed -n 2p /etc/pam.d/sudo | grep -q "tid")
then
sudo sed -i -e "2s/^/auth sufficient pam_tid.so\n/" /etc/pam.d/sudo
else
echo "TouchID already enabled for sudoing"
exit 1
fi