Skip to content

Instantly share code, notes, and snippets.

View tangoabcdelta's full-sized avatar

tangoabcdelta

View GitHub Profile
@tangoabcdelta
tangoabcdelta / change the default editor from vim to nano.md
Last active January 12, 2021 17:06
Change the default git editor from vim to nano
Change the default editor for git from vim to nano
# change the default editor from vim to nano
git config --global core.editor "nano"
or, alternatively, change the gitconfig
@tangoabcdelta
tangoabcdelta / do a git blame in git.md
Created January 12, 2021 17:07
How to do a git blame in git
How to do a git blame in git:
git blame -L306,+20 client/apps/Manage/Campaign/components/Form/Targeting/index.js

# as with any unix command, you can move the parameters to the end
# i always do it for the sake of conveniences
# because editing the line numbers, this way, becomes very easy
git blame client/apps/Manage/Campaign/components/Form/Targeting/index.js -L 306,326
@tangoabcdelta
tangoabcdelta / interactive rebase squash-and-merge.md
Created January 12, 2021 17:07
How to do Interactive Rebase, how to do squash-and-merge
How to do Interactive Rebase, how to do squash-and-merge
  • Rebase Interactive or Squash your commits are the same thing
  • Squash and Merge is different (we will discuss that in another file)
git rebase -i HEAD~2
  • If you encounter a conflict, then, resolve it
@tangoabcdelta
tangoabcdelta / clone a git repository into a non-empty directory.md
Created January 12, 2021 17:09
How to clone a git repository into a non-empty directory?
How to clone a git repository into a non-empty directory?
git init

git remote add origin PATH/TO/REPO

git fetch

git checkout -t origin/master
@tangoabcdelta
tangoabcdelta / .bash_profile
Last active January 24, 2021 19:18
sample `.bash_profile` (originally) 2015 edition, contains some snippets that will qualify as still-relevant-in-2021
export PATH=/usr/local/bin:$PATH
export PATH=/usr/bin:$PATH
export PATH=/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin:$PATH
export PATH=/Applications/Sublime\ Text.app/Contents/SharedSupport/bin:$PATH
export PATH=$HOME/mongodb/bin:$PATH
export PATH=$HOMEredis/src:$PATH
export PATH=$HOME/apache-tomcat-8.0.36/bin:$PATH
export PATH=$HOME/apache-maven-3.3.9/bin:$PATH
# if you are using nvm, you will have to
@tangoabcdelta
tangoabcdelta / break.out.of.forEach.loop.js
Created January 18, 2021 04:27
break out of a forEach loop in JavaScript
// just truncate the array's length:
const myArray = [1, 2, 3];
myArray.forEach(item => {
// ... do some stuff
if(someConditionIsMet) {
// Break out of the loop by truncating array
myArray.length = 0;
}
})
@tangoabcdelta
tangoabcdelta / uninstall.kite.instructions.md
Created January 20, 2021 21:07
How to uninstall Kite (a popular plugin which sits around eating your RAM & does just barely enough to justify its existence)
TL:DR

Run: ~/.local/share/kite/uninstall

To completely remove Kite from your system, there are a number of steps to follow
  • Uninstall all editor plugins - uninstall the editor plugins Kite has installed, instructions here: https://help.kite.com/article/62-managing-editor-plugins
  • Quit Kite - You can do so from the menu bar icon. If you don't have the menu bar icon shown, you can manually close all the Kite processes.
@tangoabcdelta
tangoabcdelta / start.stop.postgres.instructions.md
Created January 20, 2021 21:09
How to stop PostgreSQL / postgres from auto-starting during start up - Linux and Mac (how do you remove them from startup)
How to stop PostgreSQL / postgres from autostarting during start up - Linux

(works on ubuntu 16.04 or later which use systemd)

  • start - sudo service postgresql start
  • stop - sudo service postgresql stop
  • restart - sudo service postgresql restart
  • auto launch - sudo systemctl enable postgresql
  • disable auto launch - sudo systemctl disable postgresql
@tangoabcdelta
tangoabcdelta / start.stop.apache2.instructions.md
Created January 20, 2021 21:14
How to kill apache2 service running on port 80 and how to stop apache2 from launching at start up - Linux and Mac

How to stop apache2 from autostarting during start up

How to stop apache2 from autostarting during start up - Linux
  • start - sudo service apache2 start
  • stop - sudo service apache2 stop
  • restart - sudo service apache2 restart
  • enable auto launch - sudo systemctl enable apache2
  • disable apache2 auto launch - sudo systemctl disable apache2