Skip to content

Instantly share code, notes, and snippets.

@fathergoose
fathergoose / toggle_dock.sh
Created March 2, 2023 19:05
Sets the macos dock to toggle between shown and completeley hidden (no autohide/show)
/Users/al/local/bin/dock
#!/usr/bin/env bash
if [ -f .gitignore ] && [ "$1" = "-a" ]; then
echo "File .gitignore already exists. Exiting."
exit 1
fi
if [ ! -d .git ]; then
echo "No .git directory found. Exiting."
exit 1
fi
@fathergoose
fathergoose / update-neovim-nightly
Last active October 30, 2022 06:11
A script to automate the installation of the latest neovim nightly tag
#!/usr/bin/env zsh
# Author: Alexander Ilseman
# Github: @fathergoose
# Date: 2022-10-18
# Description: This script will update neovim to the latest nightly release
# System: macOS
# Check if neovim is running
if ps aux | awk '{print $11}' | grep -E '^nvim$' > /dev/null ; then
@fathergoose
fathergoose / pm.zsh
Last active October 18, 2022 18:53
Save "project" directories and navigate to them quickly
function pm() {
local pfile=$HOME/.projects
if [[ ! -f $pfile ]]; then
touch $pfile
fi
local usage="Usage: pm [-a|-d|-l|-h] [key] [path]"
# List projects
if [[ $1 == "-l" ]]; then
@fathergoose
fathergoose / lgbk.zsh
Created October 6, 2022 02:40
A script for time series journaling (logging)
#!/usr/bin/env zsh
VERSION="0.0.1"
DATE_STORAGE_FMT='%Y-%m-%dT%H:%M:%S'
if [[ $1 == "-h" || $1 == "--help" ]]; then
echo "Usage: $0 [options] [entry]"
echo "Options:"
echo " -h, --help Show this help message and exit"
echo " -v, --version Show program's version number and exit"
exit 0
@fathergoose
fathergoose / FindConsoleLogs.sh
Created August 10, 2022 23:36
Use git to get a list of files changed, do a character swap, and let rg search for console.logs
git diff --name-only -z main | tr '\n' '\0' | xargs -0 rg 'console.log'
@fathergoose
fathergoose / macos-commands.sh
Created July 6, 2017 19:41
Commands I have had to run to get macos to behave the way I want
# Save screenshots somewere else
defaults write com.apple.screencapture location <path_to_new_loc>
killall SystemUIServer
# Show hidden files in finder
defaults write com.apple.finder AppleShowAllFiles YES
# Keep the dock from sticking open -- not sure it worked
defaults write com.apple.dock autohide-delay -int 0
defaults write com.apple.dock autohide-time-modifier -float 1.0
@fathergoose
fathergoose / pre-commit.sh
Created July 6, 2017 03:28
Check for debugger statements before commiting your code.
#!/bin/sh
#
# Check for debugger statements before commiting your code.
#
# Nodejs uses 'debugger' as a keyword statement to trigger a
# breakpoint. There's literally no reason to commit such a thing
echo "Running debugger check..."
RES=`git grep -n 'debugger'`
@fathergoose
fathergoose / unix_forgetables.md
Last active August 7, 2017 21:46
Things I always forget but always need too

Use awk to grab some word(s)

It's really all I ever want to do with awk

$ echo "my name is Al" | awk '{print $4 " " $3 " " $2}'
  Al is name

Install a .deb package from cli

$ sudo dpkg -i 
hey, this is content too