Skip to content

Instantly share code, notes, and snippets.

View renkin's full-sized avatar

René Kießig renkin

  • René Kießig Digitaldienstleistungen
  • Jena, Germany
View GitHub Profile
@renkin
renkin / replaceRegexPatterns.sh
Created July 8, 2023 05:31
Script to replace a list of regex search patterns within a directory structure
#!/bin/bash
# Parameters
BASE_DIRECTORY='ToReplace'
FILE_PATTERN='*Controller.java'
# Perform find and replace operation for given search and replacement patterns
perform_replace() {
local SEARCH_PATTERN=$1
local REPLACEMENT_PATTERN=$2
@renkin
renkin / checkPortUsage.sh
Created July 8, 2022 06:57
Greps for a port in netstat output
#!/bin/bash
_printUsage() {
echo 'Usage: checkPortUsage.sh <port>'
}
### Main ###
if [[ $# -ne 1 ]]; then
_printUsage
@renkin
renkin / grep_branchname_in_git_repos.sh
Last active January 19, 2022 15:55
This script greps for a branch name in all relevant repos.
#!/bin/bash
#
# This script greps for a branch name in all relevant repos.
#
# Usage: grep_branchname_in_git_repos.sh <branch name>
# E.g.: grep_branchname_in_git_repos.sh 8.2.2
#
RELEVANT_REPOS=( repo1 repo2 )
@renkin
renkin / changed_git_repos.sh
Created January 19, 2022 15:19
This script prints out all commits after a given timestamp, usually the timestamp of the last release, in all relevant repos.
#!/bin/bash
#
# This script prints out all commits after a given timestamp, usually the timestamp of the last release, in all relevant repos.
#
# Usage: changed_git_repos.sh <start check time>
# E.g.: changed_git_repos.sh '2021-12-21T18:00:00-02:00'
#
RELEVANT_REPOS=( repo1 repo2 )
@renkin
renkin / importPostgresDump.sh
Created January 12, 2022 10:44
Import PostgreSQL Dump in Windows
# Via pgAdmin Docker Container
docker run -e PGADMIN_DEFAULT_EMAIL=test@test.de -e PGADMIN_DEFAULT_PASSWORD=1234 -d dpage/pgadmin4
MSYS_NO_PATHCONV=1 docker exec -i priceless_euclid /usr/local/pgsql-14/pg_restore -h host.docker.internal -U postgres -v -d $DATABASE_NAME < $PATH_TO_DUMP_FILE
#!/bin/bash
# Parameter 1 ist ausgeführter Git Befehl, z.B. pull
find . -maxdepth 1 -type d -path '*/[^\.]*' -not -path '*/target' -not -path '*/src' -printf '\n\n************************\n%p\n************************\n\n' -exec sh -c "cd {}; pwd; mvn $1; cd .." \;
@renkin
renkin / gitDeleteLocalOrphanedBranches.sh
Last active February 4, 2024 19:02
Update branch "develop" and delete local orphaned branches
#!/bin/bash
MAIN_BRANCH=${1:-develop}
echo
echo "Fetching..."
git fe
echo
echo "Switching to $MAIN_BRANCH..."
@renkin
renkin / gitMergeLatestIntoCurrentBranch.sh
Last active December 16, 2021 00:41
Update current branch from branch "develop"
#!/bin/bash
MAIN_BRANCH=${1:-develop}
echo
echo "Fetching..."
git fe
echo
echo "Switching to $MAIN_BRANCH..."
@renkin
renkin / gitOnSubFolders.sh
Last active December 16, 2021 00:42
Sometimes you have a folder full of Git repositories and have to update all etc.
#!/bin/bash
# Parameter 1 ist ausgeführter Git Befehl, z.B. pull
find . -maxdepth 1 -type d -path '*/[^\.]*' -not -path '*/target' -not -path '*/src' -printf '\n\n************************\n%p\n************************\n\n' -exec git -C {} fetch --all --tags --prune --progress \; -exec git -C {} status \; -exec git -C {} "$1" \;
@renkin
renkin / rsync.sh
Created July 18, 2020 18:40
RSync example
rsync -v -e ssh -r --progress rene@remote:~/Music .