People‎ > ‎John Stavrakakis‎ > ‎John's blog‎ > ‎

git repos setup

posted 20 Sep 2011, 23:40 by John Stavrakakis   [ updated 13 Oct 2011, 18:05 ]
Just getting the git repository to setup, there were a few hiccups with SSH and path that Masa sorted out. (he added git binaries path to /etc/paths). Spent the remainder of time working out how to organise this repos for adding need

I decided to make a neat little script to generate the template for reports automatically. The date command is nifty in that you can obtain the next Thursday :)

hmm code in a Gsites post:

#!/bin/bash

#
# Automatically generate latex report template for the 
# next Thursday.
#
# 2011-09-21
# John Stavrakakis

TEMPLATEFILE=../../shared/writing/report_template.tex
BIBFILE=../../shared/writing/johnbib.bib

# date of next thursday (includes today)
nextthurs=`date -v-thu "+%Y-%m-%d"`

# use date of creation
#reportdate=`date "+%d %B %Y"`

# use date of report due
reportdate=`date -v-thu "+%d %B %Y"`

### EDITED ###
# check the date is not earlier!
# seconds since 1970
datenow=`date "+%s"`
datenextthurs=`date -v-thu "+%s"`

if [ $datenow -gt $datenextthurs ]
then
echo local generated date is earlier than today!

# add one week
newdate=`echo "$datenow" + 7*24*3600 | bc`;
# update the dates used for files
nextthurs=`date -j -f "%s" $newdate "+%Y-%m-%d"`
reportdate=`date -j -f "%s" $newdate "+%d %B %Y"`
fi

echo the date today is : `date -j -f "%s" $datenow "+%d %B %Y"`
echo report date is for: $reportdate
echo file name : $nextthurs
read -n1 -p "Is this acceptable...master? (y/n) "
echo 
[[ $REPLY = [yY] ]] && echo Right away! || { echo "Aborted!"; exit 1; }


# folder for this report
FNAME=vislab_"$nextthurs"
mkdir "$FNAME"
cd "$FNAME"

# replace the DATEHERE in template file with report date
sed -e s/DATEHERE/"$reportdate"/g "$TEMPLATEFILE" > "$FNAME".tex

# link master bib file
ln -s "$BIBFILE" .
mkdir figures


Using git is quite easy if you know subversion. This guide proved useful in minimising the transition:
git was kind enough to indicate the author and email being used. and how to change it. I followed up with this command:

$ git config --global user.email me@somedomain.com
$ git commit --amend --reset-author

oh and looking at different monitors, I found that the Dell 24" U2412M specifications remains a little inferior from the U2410, reviews of practical use suggest otherwise.
Comments