Skip to content

Instantly share code, notes, and snippets.

View rajhawaldar's full-sized avatar
💻

Raj Hawaldar rajhawaldar

💻
View GitHub Profile
@rajhawaldar
rajhawaldar / .zshrc
Last active February 15, 2026 12:12
My personal ohmyzsh like setup
# ~~~~~~~~~~~~~~~ Functions ~~~~~~~~~~~~~~~~~~~~~
# If asdf is setup uncomment below line
# source /opt/homebrew/opt/asdf/libexec/asdf.sh
# ~~~~~~~~~~~~~~~ History ~~~~~~~~~~~~~~~~~~~~~~~~
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
@rajhawaldar
rajhawaldar / jq-commands.sh
Created July 1, 2024 17:39
Useful jq commands
#!/bin/bash
# Format all the json files from the directory
ls -d <dir>/* | xargs -I{} sh -c "jq -S '.' {} | sponge {}"
export GIT_PS1_SHOWDIRTYSTATE=true # show * for changes
export GIT_PS1_SHOWUNTRACKEDFILES=true # show % for new files
if [ "$color_prompt" = yes ]; then
# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;96m\]\W\[\033[00m\]\[\033[01;032m\] $(parse_git_branch)\[\033[00m\]'
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;96m\]\W\[\033[00m\]\[\033[01;032m\]$(__git_ps1)\[\033[00m\] '
# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# \033 can be replace with \e here
# PS1='${debian_chroot:+($debian_chroot)}\[\e[01;32m\]\u@\[\e[00m\]:\[\e[01;34m\]\W\[\e[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
#!/usr/bin/env bash
alias week="week"
alias day="day"
alias m="m"
alias dt="today"
alias paths="get_path"
alias cl="clear && printf '\e[3J'"
# ~~~~~~~~~~~~~~~ Aliases ~~~~~~~~~~~~~~~~~~~~~~~~
alias gb="git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
# Install debs
cd ~/Downloads
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
# Install gh cli
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
bind r source-file ~/.tmux.conf \; display "~/.tmux.conf sourced!"
bind R command-prompt "rename-window %%"
set -g mouse on
set -s escape-time 10
@rajhawaldar
rajhawaldar / .inputrc
Created November 23, 2023 17:26
Enable Auto Complete by History with Bash ~/.inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
# To stop the bell sound in terminal after empty tab press
set bell-style none
# save this file and run below command in terminal
# bind -f ~/.inputrc
@rajhawaldar
rajhawaldar / commit-msg
Created November 18, 2023 06:14
git hook to add branch name in the commit message
#!/bin/bash
# To avoid blank commit message
if [[ -z $(grep '[^[:space:]]' $1) ]]
then
echo "empty commit not allowed :("
exit 1
fi
# To add branch name in the commit message
@rajhawaldar
rajhawaldar / Convert GitHub workflow inputs to ENV variables.yaml
Last active September 6, 2023 05:02
Convert GitHub workflow inputs to ENV variables
name: "Convert workflow inputs to ENV variables Example"
on:
workflow_dispatch:
inputs:
stage:
description: "stage"
type: "string"
required: true
version: