Skip to content

Instantly share code, notes, and snippets.

View sachsgit's full-sized avatar

Sachs sachsgit

View GitHub Profile
@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'
@sachsgit
sachsgit / .bash_aliases
Last active June 9, 2023 17:16
Common Aliases for BASH
#!/usr/bin/bash
alias .......='cd ../../../../../..' # 6 Back
alias ......='cd ../../../../..' # 5 Back
alias .....='cd ../../../..' # 4 Back
alias ....='cd ../../..' # 3 Back
alias ...='cd ../..' # 2 Back
alias ..='cd ..' # 1 Back
@sachsgit
sachsgit / ClearCaches.bat
Last active December 12, 2022 18:43
This batch file clears out (completely) the caches for Internet Explorer, Chrome, Firefox and Microsoft Edge browsers, and Java Cache.
@ECHO OFF
:: REM URL: http://stackoverflow.com/questions/12621969/clear-cache-of-browser-by-command-line
IF NOT EXIST "%TEMP%" GOTO :SkipTemp
ERASE "%TEMP%\*.*" /F /S /Q
FOR /D %%i IN ("%TEMP%\*") DO RMDIR /S /Q "%%i"
:SkipTemp
IF NOT EXIST "%TMP%" GOTO :SkipTmp
ERASE "%TMP%\*.*" /F /S /Q
FOR /D %%i IN ("%TMP%\*") DO RMDIR /S /Q "%%i"
@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 / 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 / .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 / 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 / .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 / 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 / .classpath
Last active November 9, 2021 16:44
Generic classpath for Java/Maven in Eclipse
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>