Skip to content

Instantly share code, notes, and snippets.

View fegue's full-sized avatar

Felix Günther fegue

View GitHub Profile
@fegue
fegue / git_repo_status.sh
Last active December 10, 2024 10:14
Check git status of all branches and optinally recursively all repositories in a directory
#!/usr/bin/env bash
# Git Repository Status Checker
# ===========================
#
# This script checks the status of one or multiple git repositories and provides
# detailed information about:
# - Uncommitted changes
# - Stashed changes
# - Branch status (ahead/behind remote)
@fegue
fegue / Pull-Request_Merge_locally.md
Created November 12, 2024 10:38
Test Pull-Request Merge locally

Check out a pull request locally to see if it would merge without any issues, and even test it without actually merging it into the main branch. Here’s how you can do it:

Step 1: Fetch the Pull Request

First, make sure you have fetched all the pull requests from the remote repository. Replace origin with the name of your remote if it's different.

git fetch origin pull/<PR_NUMBER>/head:<BRANCH_NAME>
@fegue
fegue / start_sar.sh
Last active October 17, 2023 14:09
Use `sar`to monitor system usage and log it to a file
#!/bin/bash
#####################################################
# Script Name: System Usage Monitor for Raspberry Pi
# Description: This script uses the 'sar' command to monitor system usage on a Raspberry Pi over a specified duration.
# Usage: ./start_sar.sh <custom_name> <interval_in_seconds> <count>
#
# Installation: sudo apt install sysstat
# Source: https://github.com/sysstat/sysstat
#
# Arguments:
# see `man dnf.conf` for defaults and possible options
[main]
gpgcheck=True
installonly_limit=3
clean_requirements_on_remove=True
best=False
skip_if_unavailable=True
# added for speed
fastestmirror=True
@fegue
fegue / set_barrier_keyboard.sh
Last active March 30, 2023 08:51
Set the correct Keyboard layout on client when using barrier
#!/bin/sh
setxkbmap -device `xinput list | grep "Virtual core XTEST keyboard" | sed -e 's/.\+=\([0-9]\+\).\+/\1/'` -layout "de" -variant "nodeadkeys"
@fegue
fegue / README.md
Created November 30, 2022 17:23 — forked from mzabriskie/README.md
Check git status of multiple repos

If you're like me you have a dir like ~/Workspace/Github where all your git repos live. I often find myself making a change in a repo, getting side tracked and ending up in another repo, or off doing something else all together. After a while I end up with several repos with modifications. This script helps me pick up where I left off by checking the status of all my repos, instead of having to check each one individually.

Usage:

git-status [directory]

This will run git status on each repo under the directory specified. If called with no directory provided it will default to the current directory.

@fegue
fegue / set_hostname.sh
Created March 17, 2022 21:57
Set hostname on raspberry pi
#!/bin/sh
if test $# -eq 0
then
echo "No name on command line."
exit 1
fi
echo $1
NAME=$1
import io
import selectors
import subprocess
import sys
def capture_subprocess_output(subprocess_args):
# Start subprocess
# bufsize = 1 means output is line buffered
# universal_newlines = True is required for line buffering
process = subprocess.Popen(subprocess_args,
@fegue
fegue / mount_image.md
Created May 3, 2021 10:26
[Mount image as filesystem] MOunt Iamges and edit files as if it was a USB-Drive #linux #bash
@fegue
fegue / find_newest_files.sh
Last active May 3, 2021 09:23
[Last modified files]Recursively find newest/last modified files in directory and print them to terminal #linux, #bash, #backup,#nextcloud
#!/bin/bash
find /mnt/ncp-backup/backup-current/OekoFor -type f -printf "%T+\t%p\n" | sort | tail -10