Skip to content

Instantly share code, notes, and snippets.

@sascha-wolf
sascha-wolf / serve.bash
Last active May 30, 2020 18:29
Restart phx.server on any code change
#!/bin/sh
while true; do
fd -e ex -e exs -e eex -e leex | entr -cr mix phx.server
# 130 is SIGTERM; everything else is an error
if [ $? -ne 130 ]; then
continue
fi
@sascha-wolf
sascha-wolf / asdf-fuzzy-version-manager.sh
Created July 16, 2019 14:50
Fuzzy version manager commands for asdf
#!/bin/sh
# Install one or more versions of specified language
# e.g. `vmi rust` # => fzf multimode, tab to mark, enter to install
# if no plugin is supplied (e.g. `vmi<CR>`), fzf will list them for you
# Mnemonic [V]ersion [M]anager [I]nstall
version-manager::install() {
local lang=${1}
if [[ ! $lang ]]; then
@sascha-wolf
sascha-wolf / pre_push
Last active May 28, 2024 14:59
Elixir pre-push hook for git - ensures files are formatted correctly and credo is satisfied
#!/bin/bash
ask() {
# https://djm.me/ask
local prompt default reply
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"