Skip to content

Instantly share code, notes, and snippets.

View heywoodlh's full-sized avatar
:octocat:
Trapped in Vim

Spencer Heywood heywoodlh

:octocat:
Trapped in Vim
View GitHub Profile
View k0sctl.yaml
apiVersion: k0sctl.k0sproject.io/v1beta1
kind: Cluster
spec:
hosts:
- role: controller+worker
ssh:
address: 100.89.165.64
user: nathanhywd
noTaints: true
privateInterface: tailscale0
@heywoodlh
heywoodlh / ish-setup.sh
Last active May 25, 2023 03:48
My shell script for setting up iSH
View ish-setup.sh
#!/usr/bin/env ash
## Enable location, allow iSH to run in background
grep -q '/dev/location' $HOME/.profile || echo 'cat /dev/location > /dev/null &' >> $HOME/.profile && source $HOME/.profile
# Install my dependencies
apk update
apk add vim git coreutils openssh-client mosh tmux curl
# Setup tmux
@heywoodlh
heywoodlh / example-1.nix
Created April 14, 2023 20:08
Example of Nix's option expansion
View example-1.nix
{
programs.zsh.enable = true;
programs.zsh.enableAutosuggestions = true;
programs.zsh.envExtra = ''
export MYVAR="true"
export MYVAR2="false"
'';
}
View macos-battpop.sh
#!/usr/bin/env bash
title="Battery"
battery_level="$(pmset -g batt | grep 'InternalBattery' | awk '{print $3 $4}' | awk '{print $1}' | cut -d';' -f1)"
osascript -e "display notification \"${battery_level}\" with title \"${title}\""
View macos-notify-send.sh
#!/usr/bin/env bash
# Usage: macos-notify-send.sh "Title" "Message"
osascript -e "display notification \"$2\" with title \"$1\""
@heywoodlh
heywoodlh / plex.nix
Created March 14, 2023 22:34
Simple Plex configuration for MacOS
View plex.nix
{ config, pkgs, ... }:
{
#package config
nix.package = pkgs.nix;
nixpkgs.config.allowUnfree = true;
#homebrew packages
homebrew = {
enable = true;
@heywoodlh
heywoodlh / steamdeck.sh
Created January 3, 2023 01:13
Commands I run to re-set my Steam Deck backup after an update
View steamdeck.sh
sudo steamos-readonly disable
sudo pacman -Sy --noconfirm wireguard-tools resolvconf
# Re-enable wireguard and sshd
sudo systemctl enable --now wireguard.service
sudo systemctl enable --now sshd.service
# Disable power-save so SSH commands aren't so delayed: https://gitlab.com/popsulfr/steam-deck-tricks#disable-powersave-on-wlan0-for-snappier-remote-command
sudo iw dev wlan0 set power_save off
View run.sh
#!/usr/bin/env bash
media_dir="/Volumes/DataStore2"
root_dir="/Volumes/DataStore2/plex_containers"
docker network ls | grep -q plex && docker network create plex
mkdir -p ${root_dir}
#docker run -d --restart unless-stopped --name plex \
# -v ${root_dir}/plex:/config \
View pack-kernel.sh
#!/usr/bin/env bash
# Variable for path to mobile-nix boot.img
mobile_nix_boot_img_path='./mobile-nix-boot.img'
# Variable for path to lineage boot.img (recovery)
lineage_boot_img_path='./lineage-boot.img'
# Variables for directory names to place extracted contents
lineage_out_dir='lineage-extracted'
mobile_nix_out_dir='mobile-nix-extracted'
@heywoodlh
heywoodlh / pbcopy
Created October 3, 2022 16:54
Cross-platform (MacOS, Linux, FreeBSD) pbcopy
View pbcopy
#!/usr/bin/env bash
if uname -a | grep -iq Darwin &>/dev/null
then
/usr/bin/pbcopy
else
xclip -r -selection clipboard
fi