Skip to content

Instantly share code, notes, and snippets.

View ScottJWalter's full-sized avatar
🔮
Particle. Wave. It's all data.

Scott Walter ScottJWalter

🔮
Particle. Wave. It's all data.
View GitHub Profile
@ScottJWalter
ScottJWalter / install-zsh-plugins.sh
Created April 8, 2025 17:44
Install collection of zsh plugins
#!/bin/sh
declare -a PLUGINS=(
"zsh-users/zsh-completions"
"zsh-users/zsh-autosuggestions"
"MichaelAquilina/zsh-you-should-use"
"zdharma-continuum/fast-syntax-highlighting"
"djui/alias-tips"
"akarzim/zsh-docker-aliases"
)
@ScottJWalter
ScottJWalter / clone_sd_card.sh
Last active April 7, 2025 02:36
Copy a linux (lfs) sd card
#!/bin/sh
# Identify /dev/??? device of card
sudo fdisk -l
# if mounted (boot), must unmount
sudo umount /dev/????
# create image ...
sudo dd if=/dev/???? of=./sd_card.img bs=4M status=progress && sync
@ScottJWalter
ScottJWalter / .p10k.zsh
Last active April 6, 2025 17:52
Powerlevel10k tweak to add OS version number to prompt
# STEP1: in ~/.p10k.zsh, find and alter:
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
os_icon
os_version # ADD THIS LINE
...
)
# STEP2: Still in ~/.p10k.zsh, after the `typeset` you just edited,
# add the following:
@ScottJWalter
ScottJWalter / update-firefox-dev.sh
Created March 6, 2025 09:49
Update Firefox Developer Edition
#!/bin/bash
rm -rf ~/.ffd-tmp && mkdir -p ~/.ffd-tmp && pushd ~/.ffd-tmp
wget -O firefox-developer.tar.xz https://download.mozilla.org/?product=firefox-devedition-latest-ssl&os=linux64&lang=en-US
sudo mv /opt/firefox ./firefox.bak
sudo find . -type d -exec chmod 777 {} \;
sudo find . -type f -exec chmod 777 {} \;
#!/data/data/com.termux/files/usr/bin/bash
am start -a android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS -d package:com.termux
echo -ne "\n Checking if Termux has storage permission..."
rm -r ~/storage >/dev/null 2>&1
if ! touch /storage/emulated/0/.tmp_check_termux >/dev/null 2>&1
then
echo -e "\nGrant Termux storage permission and run the script again\n"
termux-setup-storage
#!/data/data/com.termux/files/usr/bin/bash
if [ -z "$1" ]
then
echo "No input file specified"
exit 1
fi
echo -ne "\n Checking if Termux has storage permission..."
rm -r ~/storage &>/dev/null
@ScottJWalter
ScottJWalter / hackeyMotionWaitVibrate.sh
Created January 18, 2025 17:15 — forked from cgarz/hackeyMotionWaitVibrate.sh
A hacky Termux bash script that uses the accelerometer to make an alarm that fires when the phone changes orientation.
#!/data/data/com.termux/files/usr/bin/bash
echo "getting wake lock state"
termux-notification-list | jq -r '.[] | select(.id == 1337).content' | grep -qF 'wake lock held' && locked="true" || locked="false"
if [ "$locked" = "false" ]; then
echo "wake lock not set, setting for duration of script"
termux-wake-lock
else
echo "wake lock set, Will not alter wake lock state."
fi
@ScottJWalter
ScottJWalter / venv_on_cd.sh
Last active January 17, 2025 16:59
Activate/deactivate venv as you move around the directory tree
#!/bin/sh
# add to .bashrc/.zshrc/... to wrap the cd command with a venv check
# NOTE: This assumes '.venv' is the virtual environment directory
#
function cd() {
builtin cd "$@"
if [[ -z "$VIRTUAL_ENV" ]] ; then
## If env folder is found then activate the vitualenv
@ScottJWalter
ScottJWalter / obsidian-pagebreaks.css
Created December 25, 2024 01:01 — forked from liamcain/obsidian-pagebreaks.css
Obsidian Pagebreaks
/**
Create pagebreaks in exported Obsidian PDFs.
Example:
# Heading 1
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type