Skip to content

Instantly share code, notes, and snippets.

View major0's full-sized avatar
🏠
Working from home

Mark Ferrell major0

🏠
Working from home
View GitHub Profile
@major0
major0 / fstab
Last active April 2, 2025 11:22
BTRFS Root Snapshot support on Ubuntu
# This is a copy of my /etc/fstab for my Desktop workstation. The goal
# of this design is to allow easy rollbacks of the rootfs via btrfs
# snapshots which are created any time apt modifies the system.
##
# The default rootfs volume needs some special attention in order to "default"
# correctly while also allowing grub-btrfs to select a new snapshot for the
# rootfs:
# - use btrfs subvol set-default @ instead of specifying the rootfs volume on the kernel CLI.
# - modify /etc/grub.d/[12]0_linux* and remove references to the `rootsubvol`
@major0
major0 / cli.py
Last active March 20, 2025 15:41 — forked from mivade/cli.py
Using a decorator to simplify subcommand creation with argparse
"""This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@major0
major0 / starship.toml
Last active February 3, 2025 20:41
"${HOME}/.config/starship.toml
"$schema" = "http://starship.rs/config-schema.json"
# Inserts a blank line between shell prompts
add_newline = false
[status]
disabled = false
format = '[$status]($style$signal_name)'
@major0
major0 / .bashrc
Last active February 3, 2025 20:42
##
# Colorized man pages.
# simply add to .bashrc/.profile/.zprofile/etc.
man() {
env \
LESS_TERMCAP_mb="$(printf '\e[1;31m')" \
LESS_TERMCAP_md="$(printf '\e[0;36m')" \
LESS_TERMCAP_me="$(printf '\e[0m')" \
LESS_TERMCAP_se="$(printf '\e[0m')" \
LESS_TERMCAP_so="$(printf '\e[01;44;33m')" \
@major0
major0 / gitconfig
Last active November 12, 2024 19:27
[color]
ui = auto
[branch]
autoSetupMerge = true
autoSetupRebase = always
[push]
default = current
[pull]
rebase = true
@major0
major0 / git-rewrite-author.sh
Last active May 21, 2024 05:02
Write Author Name/Email in git's commit history.
#!/bin/sh
# git-rewrite-author.sh
#
# Rewrite git-commit author's Name/EmailAddress.
#
# Based on previous versions of this tool This version runs in POSIX compliant
# shell and .. IMHO .. cleans up a large portion of the filter logic and the
# core syntax such that is is readable and not full of back-slash escape hell.
#
# Other versions:

Keybase proof

I hereby claim:

  • I am major0 on github.
  • I am majortrips (https://keybase.io/majortrips) on keybase.
  • I have a public key ASCDTY9Puey-jbSVOeBFoEKUaPAostZ3yEXtd3AKEbNC-Qo

To claim this, I am signing this object:

@major0
major0 / git-backport.sh
Created April 11, 2017 18:10
Tool to aid back-porting a dev->topic_branch onto a release->integration branch.
#!/bin/sh
# Backport a topic-branch based on a development line back to a release branch.
# Generally this is a proof-of-concept/notes on overall process. Needs a number
# of sanity checks added before it is a real tool.
set -e
error() { echo "error: $*" >&2; }
die() { error "$*"; exit 1; }
## Update Branches
# FIXME we need to sanity check all the arguments
start="${1}" # What rev to reset the target to before merging
@major0
major0 / gist:498f83a8606d4b1c5f54
Last active August 29, 2015 14:02
Non-working git config for aiding in a PQM based workflow
[push]
default = current
[remote "origin"]
url = [email protected]:project.git
fetch = +refs/heads/master:refs/remotes/origin/master
[remote "pqm"]
url = [email protected]:project.git
fetch = +refs/heads/personal/user/pqm/*:refs/remotes/personal/user/pqm/*
[branch "master"]
remote = origin
# One of two versions of seq() borrowed from shlib and used for some benchmarks of various /bin/sh implementations
seq()
{
test "$#" -eq 1 && set -- 1 "${1}"
test "$#" -eq 2 && set -- "${1}" 1 "${2}"
test "$#" -gt 3 && die "seq: extra operand '${4}'"
if test "${2}" -gt '0'; then
while test "${1}" -le "${3}"; do
echo "${1}"
set -- "$((${1} + ${2}))" "${2}" "${3}"