Skip to content

Instantly share code, notes, and snippets.

View albrow's full-sized avatar

Alex Browne albrow

  • Harmony Intelligence
  • San Francisco, CA
View GitHub Profile
@albrow
albrow / mark.sh
Last active June 12, 2022 00:59
Bash Bookmarks
###
# A bookmarking implementation based on
# http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html
# and https://news.ycombinator.com/item?id=6229001
# and https://gist.github.com/albrow/10684515
#
# put this in ~/.bash_profile or ~/.bashrc
#
# USAGE:
# mark <name>
@albrow
albrow / confirm.go
Last active April 16, 2023 03:03
Go (golang): How to ask for user confirmation via command line
import (
"fmt"
"log"
"os"
"sort"
)
// askForConfirmation uses Scanln to parse user input. A user must type in "yes" or "no" and
// then press enter. It has fuzzy matching, so "y", "Y", "yes", "YES", and "Yes" all count as
// confirmations. If the input is not recognized, it will ask again. The function does not return