journal (Sun May 17 2020)

Week of May

  • #ruby
  • #mac
  • #bash
  • #dance
  • #zouk
  • #wiliam

Realized Ruby has a neat way to generate random rand(1..10) rand(1...10)


Fixed my annoying problem of my mac reordering windows when I didnt want it to

Observed a really nice move by William at a demo. Will need to figure this one out.

Learnt ways to run a command inside a bash script my_variable=$(command-name-here)

Prevent next command in shell script from running when previous fails

set -e 
set -o pipefail

Get the current branch name in GIT

git rev-parse --abbrev-ref HEAD

Replace a line in unix Uses streameditor sed -i 's/old-text/new-text/g' input.txt

sed doesnt work correctly in mac, so I had to use a extra char

Error invalid command code . sed

Replace a particular line in a file

sed -i '1 i' .gitignore

How to delete a line in a file via bash