Skip to content

Instantly share code, notes, and snippets.

View sebble's full-sized avatar

Sebastian Mellor sebble

  • Sebble.com
  • Newcastle upon Tyne
View GitHub Profile
@sebble
sebble / stars.sh
Last active August 25, 2025 09:04
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo
@sebble
sebble / run_per.sh
Created February 6, 2017 13:03
Run a shell script only once per time interval
#!/bin/sh
# Configuration
INTERVAL=10 # (seconds)
LASTRUN=".lastrun" # (optional)
# Run_per logic
NOW=$(date +%s)
test -f "$LASTRUN" && THEN=$(cat "$LASTRUN") || THEN=0
test $INTERVAL -gt $(($NOW - $THEN)) && exit 0
@sebble
sebble / .bash_aliases
Last active February 19, 2017 11:16
Dokku 'alias' for host running Dokku as a container
dokku() { docker exec -i "$(docker ps|awk '$2=="sebble/dokku"{print $1}'|head -1)" sudo dokku "$@"; }
@sebble
sebble / main.go
Last active November 13, 2021 18:03
An idea for capturing context of errors in go for better logging
package main
import (
"errors"
"fmt"
"os"
"github.com/go-kit/log"
)