Skip to content

Instantly share code, notes, and snippets.

View msucil's full-sized avatar

Sushil Ale msucil

View GitHub Profile
@msucil
msucil / remove-local-git-branches.sh
Created May 15, 2022 07:21
Remove Non Tracking Local Branches in Git
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
@msucil
msucil / prepare-commit-message.sh
Created January 6, 2022 12:33
Append Branch Prefix in Git Commit Messages of Pattern ISSUE-1919
#!/bin/bash
FILE=$1
MESSAGE=$(cat $FILE)
COMMIT_PREFIX=$(git rev-parse --abbrev-ref HEAD | grep -Eo '^(\w+/)?(\w+[-_])?[0-9]+' | grep -Eo '(\w+[-])?[0-9]+' | tr "[:lower:]" "[:upper:]")
if [[ $COMMIT_PREFIX == "" || "$MESSAGE" == "$COMMIT_PREFIX"* ]];then
exit 0;
fi
echo "$COMMIT_PREFIX $MESSAGE" > $FILE
@msucil
msucil / tail.sh
Created December 15, 2021 06:55
view log in realtime
tail -f -n 25 /var/log/filename.log
@msucil
msucil / gitlab-ci-cache.yml
Created December 2, 2021 04:46
Caching of maven dependency on gitlab on build
services:
- docker:19.03.1-dind
variables:
# Instruct Testcontainers to use the daemon of DinD.
DOCKER_HOST: "tcp://docker:2375"
# Improve performance with overlayfs.
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository/"
@msucil
msucil / s3-public-policy.json
Last active December 2, 2021 04:48
S3 Policy to make public bucket accessible
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
@msucil
msucil / screen-commands.md
Created September 28, 2021 17:57
screen commands to handle multiple screen in ubuntu

screen #start screen session

screen -ls #list available screens

screen -r #attach screen session

ctrl + a + d #detach current screen session

screen -XS quit #quits PID screen

@msucil
msucil / daterange.sh
Created September 28, 2021 17:33
looping date between range
start=$1
end=$2
datevalue=0
start=$(date -d $start +%Y%m%d)
end=$(date -d $end +%Y%m%d)
while [ $start -le $end ]
do
echo $start
@msucil
msucil / gist:4697085d0c946907dfce764a31f7a768
Created May 10, 2021 12:43
HTML Email Client Testing Tool
https://htmlemail.io/send/
@msucil
msucil / ngnix-minmal-configuration.md
Created February 16, 2021 10:48
Ngnix Minmal Configuration
server {
        server_name domain_name; #domain name eg: facebook.com
        
        #config request body size, usable for file upload
        client_max_body_size 2M

        location / {
                proxy_pass http://0.0.0.0:9091; # local_id:port