Skip to content

Instantly share code, notes, and snippets.

@amitk
amitk / .bash_profile
Created October 22, 2020 12:11
Add branch name to you terminal mac/Linux
# in you home direactory in the bash profile to display branch name in terminal add parsing script
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
# It will delete all the files with there names matching the regex at once.
ls | grep <regex> | xargs rm
# eg.
# If we have files in our folder as "file.txt", "example.php", "new.html", "file_one.rb"
# For deleting files with "file" in their names just execute
# ls | grep file | xargs rm
# Add them to ~/.bash_profile
# reload bash profile in terminal using $. ~/.bash_profile
# git alias
alias gs="git status"
alias gpush="git push"
alias gpull="git pull"
alias gs="git status"
alias ga="git add"
alias gstash="git stash"
@amitk
amitk / PR Etiquette
Last active July 21, 2021 16:22
List of Etiquette to follow for better code and less cycles of review on PR
The purpose of this document is to record an etiquette guide for all pull requests in the any repository. Like all etiquette, it is designed to make life easier for everyone, and if a guideline ever becomes restrictive, we should reevaluate it.
This can generally be applied to other repos managed by Team 105.
# Contents
1. [Size](#size)
2. [Sequential PRs](#sequential-prs)
3. [Labels](#labels)
4. [Branch Names](#branch-names)
# Delete all containers
docker rm -vf $(docker ps -aq)
# Delete all images
docker rmi -f $(docker images -aq)
brew tap-new $USER/<package-name>
brew extract --version=<version-no> $USER/<package-name>
brew search /<package-name>/
brew install <path to local formula>
@amitk
amitk / postgres_database.yml
Last active November 1, 2022 10:40
database.yml
default: &default
adapter: postgresql
encoding: unicode
username: postgres
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
@amitk
amitk / Dockerfile
Created December 24, 2022 19:27
Docker file to create a rails application with ruby slim image
FROM ruby:3.1.1-slim
WORKDIR /usr/src/app
RUN apt-get update && \
apt-get install ruby-full build-essential -y && \
apt-get install libpq-dev -y
COPY . .