Financial Trend Analysis

Purpose - to visualize our spending habits and identify trends so that we can take action before we find ourselves in trouble!

Basic process overview

  • gather data files from various locations
  • process data files into one format
    perhaps [date, transaction amount, name]
  • graph the unified data
    first pass just graphs all the transactions
    at a later point we could make improvements to the graph

scatter

Bash file to parse a bank export:

#!/bin/bash

INPUT=bank_datafile.csv
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read date no description debit credit
do
       if [ ${#credit} -gt 0 ] ;then
        amount=$credit
    else
        amount=$debit
    fi

    echo $date,$( printf "%.2f" $amount ),$description
done < $INPUT
IFS=$OLDIFS

Remove the double quotes and multiple spaces:

$ sed -i.bak 's/"//g' pre_parsed_datafile.csv
$ sed -i.bak ’s/  / /g’ pre_parsed_datafile.csv

Read the parsed file and print data:

import csv
import datetime
import time

with open('cleaned_transaction.data', newline='') as f:
    reader = csv.reader(f)
    for row in reader:
        date_str = row[0]

        date_num = datetime.datetime.strptime(date_str, "%m/%d/%y")
        seconds_since_epoch = time.mktime(date_num.timetuple()) * 1000
        print(seconds_since_epoch,",", row[1])

Plot arrays of data:

import matplotlib.pyplot as plt
x = [1378191600000.0 ,1378191600000.0 ,1378105200000.0 ]
y = [-9.89,-10.48,-5.69]
plt.plot(x,y,'ro')
plt.show()

Basic setup of Fedora 20 firewall

After almost a decade of using Centos and Red Hat, jumping into Fedora 20 can be quite a learning experience, let's take one step at a time.

Firewall
To start with, firewall administration is now administered through zones which are administered with the firewall-cmd . In order to start making use of anything with a Linux command line utility, one must start by knowing the state of things:

$ firewall-cmd --state
$ firewall-cmd --list-all-zones
$ firewall-cmd --zone=public --list-ports

If you don't have the necessary ports open, they can be opened up explicitly:

$ firewall-cmd --zone=public --permanent --add-port=80/tcp
$ firewall-cmd --zone=public --permanent --add-port=22/tcp

or you can use the pre-defined zones:

$ firewall-cmd --add-service=http --permanent
Previous Page