Skip to content

Instantly share code, notes, and snippets.

View meros's full-sized avatar

Alexander Schrab meros

View GitHub Profile
@meros
meros / up.sh
Last active December 4, 2022 17:26
Set upstream to branch, pull with --rebase. Also stash/stash pop before/after.
#!/bin/bash
# Set the `set -e` and `set -o pipefail` options to exit gracefully if any
# command fails and to propagate the exit status of a command in a pipe
set -e
set -o pipefail
# Set the remote repository name (default: origin)
REMOTE_NAME=${1:-origin}
@meros
meros / repos.sh
Created December 4, 2022 16:58
This script is a command-line utility that uses fzf to quickly navigate to a Git repository.
#!/bin/bash
# Set the default directory to search
search_dir=~/git
# Check if a directory was specified as an argument
if [ $# -gt 0 ]; then
# Use the specified directory as the search directory
search_dir=$1
fi
@meros
meros / b.sh
Last active December 5, 2022 13:08
A bash script to checkout a recently used branch again (useful when switching between branches often)
#!/bin/bash
# Check if fzf is installed
if ! [ -x "$(command -v fzf)" ]; then
# Check if brew is available
if [ -x "$(command -v brew)" ]; then
# Install fzf using brew if it is not installed
brew install fzf
else
# Print a message explaining how to install fzf manually
#!/usr/bin/env bash
# Define the lyrics of the song as an array of strings
lyrics=(
"🎶 We're the programmers, fixing bugs all day"
"Coding away, working hard"
"We'll make your software run"
"Without any hiccups, we'll make it fun"
"We'll squash those bugs, one by one"
"Until your program is done 🎵"
@meros
meros / gist:d4f3554b2b704b67dffcd2bbcb790c1b
Last active December 4, 2022 17:17
Bash script to create valid root cert/web server cert for development purposes
#!/bin/bash
# Set the DNS name for the web certificate
DNS=app-192-168-10-74.nip.io
# Set the filename for the generated CA
CA=ca
# Generate the CA
openssl genrsa -out $CA.key 2048