Skip to content

Instantly share code, notes, and snippets.

View SujitSingh's full-sized avatar

Sujit Kumar Singh SujitSingh

View GitHub Profile
@SujitSingh
SujitSingh / multiple-git-ssh-keys-config.md
Last active September 13, 2022 14:16
Multiple Git SSH keys config for different accounts

Setting multiple Git SSH keys configs for different accounts

1. Generate SSH keys with different names

ssh-keygen -t rsa -C "my_email@domain.com"

Keep them with different names. Lets say I created mine having path as followings -

@SujitSingh
SujitSingh / git-bash-window-like-view-on-ubuntu.md
Last active September 13, 2022 13:39
Change Ubuntu's terminal to look like Git-bash of Window

Change Ubuntu's terminal to look like Git-bash of Window

Add these code in the .bashrc file present in Home folder. Find it using ~/.bashrc/ command.

# git branch info if present
parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\[\033[36m\]\u@\h\[\033[00m\] \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \n\[\033[1;31m\]>>\[\033[00m\] "
@SujitSingh
SujitSingh / objects-arrays-comparision.md
Last active July 26, 2019 11:27
Compare n-level Objects/Arrays to get differences between them

Compare n-level Objects/Arrays to get differences between them

function compareObjs(base, val2, keyName) {
  if (base && val2) {
    if (base.constructor === Object && val2.constructor === Object) {
      let baseArr = Object.keys(base);
      let ar2 = Object.keys(val2);
      let baseLen = baseArr.length;
@SujitSingh
SujitSingh / debounce.md
Created December 21, 2021 21:18
Debounce in TypeScript

Debounce

function debounceFunction ({
  targetFunction,
  delay = 300,
  immediate = false,
  context,
}: {
 targetFunction: (...args: any[]) => any;