Skip to content

Instantly share code, notes, and snippets.

View knoxilla's full-sized avatar
🤔
Well That's Fun!

Thomas Knox knoxilla

🤔
Well That's Fun!
View GitHub Profile
@knoxilla
knoxilla / git-mstat
Last active October 25, 2021 18:52
Git command to get ahead-behind status for current branch against _all_ remotes, not just origin
#!/usr/bin/env bash
# Get ahead-behind status for current branch against _all_ remotes
# To use, put this executable script anywhere on your PATH
# TODO make git alias instead of a PATH git-<command> executable
BRANCH=$(git branch --show-current)
# Could override branch with argument but let's keep it simple
# BRANCH=${1-${BRANCH}}

Change 'master' to 'main' in place from local Github clone

The scenario:

  • You have a local clone of a Github-hosted repo with master as the default branch
  • Optionally, you have the hub command-line tool installed
  • Optionally, you have a Github Personal Access Token that can write to the relevant repos
@knoxilla
knoxilla / mdate,py
Created February 25, 2022 16:11
mdate - Endless March
#!/usr/bin/env python3
"""Endless March"""
from datetime import datetime
import subprocess
actual_date = subprocess.run("date",capture_output=True, text=True)
actual_date_parts = actual_date.stdout.split()
today = datetime.now()