Skip to content

Instantly share code, notes, and snippets.

View sachsgit's full-sized avatar

Sachs sachsgit

View GitHub Profile
@sachsgit
sachsgit / CreateMavenProject.bat
Created November 9, 2021 20:18
Batch File to Create a Maven Project Param1 is Group Id and Param2 is Artifact ID
@ECHO OFF
SET GROUPID=%1
SET ARTIFACTID=%2
mvn archetype:generate^
-DinteractiveMode=false^
-DarchetypeArtifactId=maven-archetype-quickstart^
-DgroupId=%GROUPID%^
-DartifactId=%ARTIFACTID%
@sachsgit
sachsgit / .gitconfig
Created November 17, 2021 16:01
My Git Config in $HOME directory
[color]
ui = auto
[core]
autocrlf = false
longpaths = true
[credential]
helper = wincred
useHttpPath = true
[http]
sslVerify = true
@sachsgit
sachsgit / convertAllFilesToUnix.sh
Created November 18, 2021 16:06
UNIX `find` command to find all files to apply the `dos2unix` command on them
#!/bin/bash
find . -type f \
\( -not -path "*/.git/*" \
-and -not -path "*/target/*" \
-and -not -path "*/.metadata/*" \
-and -not -path "*/.sonar*/*" \) \
-exec grep -Iq . {} \; \
-exec grep -U $'\015' {} \; \
-exec dos2unix {} \; \
-print
@sachsgit
sachsgit / .gitignore
Last active November 18, 2021 16:34
Standard Windows/Maven/Java Project Git Ignore File
# Compiled class file
*.class
target/
bin/
\.settings/
\.project$
\.classpath$
# Log file
*.log
@sachsgit
sachsgit / log4j2.xml
Created December 2, 2021 20:36
Log4j 2 Property XML File
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration>
<Configuration status="WARN">
<Appenders>
<File fileName="logs/InfoLogs.log" name="infoFile" append="false">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} | %c{1} %L - %msg%n" />
</File>
<File fileName="logs/ErrorLogs.log" name="errorFile" append="false">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} | %c{1} %l - %msg%n" />
</File>
@sachsgit
sachsgit / Git_RemoveStaleBranchs.sh
Created October 28, 2022 14:28
Git Bash Shell Script to Remove Stale/Merged Branches
#!/bin/sh
# https://stackoverflow.com/questions/7726949/remove-local-branches-no-longer-on-remote
git branch --merged >/tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches
rm /tmp/merged-branches
@sachsgit
sachsgit / .git_aliases
Last active July 20, 2023 17:29
Aliases for GIT Bash
#!/bin/bash
alias s.g='. $HOME/.git_aliases'
### Git Aliases
alias gA='echo $ git add -A; git add -A;'
alias gcb='git branch | grep "*" | cut -c3-'
alias gcm='echo $ git checkout master; git checkout master;'
alias gf='echo $ git fetch --all --prune; git fetch --all --prune;'
alias ggc='git gc --aggressive --prune=1w'