Skip to content

Instantly share code, notes, and snippets.

@rbarbey
rbarbey / bootstrap.go
Last active November 29, 2020 08:52
Bootstrapping Cobra Commands From a Config File
package cmd
import (
"log"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
// Task tries to be similar to os.exec.Cmd
type Task struct {
@rbarbey
rbarbey / fibonacci.exs
Created September 7, 2015 21:41
My first (rather academic) program in Elixir
defmodule Fibonacci do
def number(0) do
1
end
def number(1) do
1
end
def number(n) do
@rbarbey
rbarbey / git_prompt.sh
Last active October 19, 2015 08:15
Git bash prompt
function git_prompt {
# get the current status in short notation
local status=$(git status -sb 2> /dev/null)
# if we don't get any output, we're not in a git repo
if [ -z "$status" ]; then
return
fi
# determine color for displaying the branch name