Skip to content

Instantly share code, notes, and snippets.

@harsh183
Created September 6, 2019 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harsh183/f1de3e6dfda4c9a38fcdb05ff5713ad1 to your computer and use it in GitHub Desktop.
Save harsh183/f1de3e6dfda4c9a38fcdb05ff5713ad1 to your computer and use it in GitHub Desktop.
#!bin/bash
# This script is for me creating my brain dumps that I usually do jumping right into it in vim.
# I have a template file also defined that I can setup if I want.
# This script also brings me back to the same context that I was in earlier
set -ex
cd ~/brain-dumps/
# Ex. 2019-04-14
DATE=`date +%Y-%m-%d`
EXTENTION='.md'
FILE_NAME="$DATE$EXTENTION"
if test -f "$FILE_NAME"
then
echo "File exists. Opening existing for $DATE"
else
# Simple template
echo "# Brain dump $DATE" >> $FILE_NAME
fi
vim $FILE_NAME
git add $FILE_NAME
git commit -m "Brain dump $FILE_NAME"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment