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 / 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 / Timesheet Worksheet Macros
Last active October 27, 2021 17:52
Macros for Dealing with Timesheet
Option Explicit
Sub CreatePayPeriod()
Dim colStart, colLast, colIndex, colSum
Dim colSumLetter, colLetter, colStartLetter, colLastLetter, colSecondWeekLetter
Dim rowDate, rowSum, intWeekend, rowDay, rowHourStart, rowHourLast, rowAccum, rowLast
Dim rowSecondWeekSum, rowSecondWeekAccum, secondWeek
Dim dtStart, dtCurrent, dtLast
Dim i
Dim colRows As Collection
@sachsgit
sachsgit / .bash_profile
Created October 25, 2021 22:25
Common BASH Profile file
# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
trap 'test -n "$SSH_AGENT_PID" && eval `/usr/bin/ssh-agent -k`' 0
@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