Skip to content

Instantly share code, notes, and snippets.

View bashbunni's full-sized avatar
❤️‍🔥

bashbunni bashbunni

❤️‍🔥
View GitHub Profile
@bashbunni
bashbunni / main.go
Created January 22, 2025 23:55
textinput bubble with bash history (bubbles#631)
package main
import (
"fmt"
"log"
"os/exec"
"strings"
"github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/textinput"
@bashbunni
bashbunni / commits-since-last-version.sh
Created October 17, 2024 18:40
Helper script to view number of commits since last release
#!/usr/bin/env sh
# This is a helper script to decide when you might need a new release.
# Prints the number of commits between origin/main or origin/master and the latest release for the selected repos.
# provide a directory path that includes your repos
if [ -z $1 ]; then
echo "Please provide a path to a directory housing your repos"
exit 1
fi
@bashbunni
bashbunni / releases.sh
Created August 14, 2024 20:32
Use GitHub CLI to check for overdue releases
#!/usr/bin/env sh
# Run this script in the directory that contains repos whose release dates you
# want to check.
for dir in */; do
# check if it's a git repo
cd $PWD/$dir
if [ -d ".git" ]; then
latest=$(gh release ls | grep "Latest")
@bashbunni
bashbunni / main.go
Created July 12, 2024 20:06
gofeed sorting issue
package main
import (
"sort"
"time"
"github.com/mmcdole/gofeed"
)
// RSSEntry represents a single RSS entry.
@bashbunni
bashbunni / main.go
Created January 11, 2023 06:55
Redirect Output From Program
package main
import (
"bytes"
"fmt"
"os"
"os/exec"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@bashbunni
bashbunni / diff.txt
Last active January 11, 2023 15:15
Validate Min Length Credit Card Example Bubble Tea
131a132,145
> func (m model) checkMinLen() error {
> var err error
>
> c := m.inputs[m.focused]
> if len(c.Value()) != c.CharLimit {
> err = fmt.Errorf(
> "%s should be at least %d characters",
> c.Value(),
> c.CharLimit,
@bashbunni
bashbunni / main.go
Created January 11, 2023 03:50
ValidateFunc Blocking Workaround
package main
import (
"fmt"
"log"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@bashbunni
bashbunni / .zshrc
Created January 4, 2023 16:28
CLI Pomodoro for Linux
# study stream aliases
# Requires https://github.com/caarlos0/timer to be installed. spd-say should ship with your distro
declare -A pomo_options
pomo_options["work"]="45"
pomo_options["break"]="10"
pomodoro () {
if [ -n "$1" -a -n "${pomo_options["$1"]}" ]; then
val=$1
@bashbunni
bashbunni / main.go
Created December 21, 2022 23:04
Bubbles Table Customization
package main
/* This gist shows a table bubble with custom styles and a special case
where the row will get highlighted red to show how to do conditional formatting*/
import (
"fmt"
"os"
"github.com/charmbracelet/bubbles/table"
@bashbunni
bashbunni / .zshrc
Created October 27, 2022 21:41
CLI Pomodoro for Mac
# I'll be doing another one for Linux, but this one will give you
# a pop up notification and sound alert (using the built-in sounds for macOS)
# Requires https://github.com/caarlos0/timer to be installed
# Mac setup for pomo
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\
-title 'Work Timer is up! Take a Break 😊'\
-appIcon '~/Pictures/pumpkin.png'\
-sound Crystal"