@@ -1 +1,2 @@ | |||
.DS_Store | |||
*.pyc |
@@ -31,14 +31,16 @@ mailoffsite: imapbackup | |||
databackup: dvbackup imapbackup | |||
backup.command | |||
clean: | |||
cleanup: | |||
-mkdir -p $(HOME)/Documents/$(YYYYMM) | |||
-mv $(HOME)/Desktop/* $(HOME)/Documents/$(YYYYMM) | |||
clean: cleanup | |||
@echo $(PREFIX) $@ $(SUFFIX) | |||
@-rm -rf ~/tmp/* | |||
@-rm -rf ~/Library/Caches/* | |||
@-rm -rf ~/.Trash/* | |||
@-rm -rf $(JUNKFILES) | |||
-mkdir -p $(HOME)/Documents/$(YYYYMM) | |||
-mv $(HOME)/Desktop/* $(HOME)/Documents/$(YYYYMM) | |||
size: | |||
du -sh $(HOME) |
@@ -0,0 +1,41 @@ | |||
#!/usr/bin/python | |||
from pystatsd import Client | |||
class LinuxNetStats(object): | |||
def __init__(self): | |||
self.d = self._get() | |||
def _get(self): | |||
# thx | |||
# http://stackoverflow.com/questions/1052589/ | |||
# how-can-i-parse-the-output-of-proc-net-dev- | |||
# into-keyvalue-pairs-per-interface-u | |||
lines = open("/proc/net/dev", "r").readlines() | |||
columnLine = lines[1] | |||
_, receiveCols , transmitCols = columnLine.split("|") | |||
receiveCols = map(lambda a:"rx_"+a, receiveCols.split()) | |||
transmitCols = map(lambda a:"tx_"+a, transmitCols.split()) | |||
cols = receiveCols+transmitCols | |||
faces = {} | |||
for line in lines[2:]: | |||
if line.find(":") < 0: continue | |||
face, data = line.split(":") | |||
face = face.lstrip() | |||
faces[face] = dict(zip(cols, data.split())) | |||
return faces | |||
def forStatsd(self,prefix=''): | |||
out = {} | |||
for iface in self.d.keys(): | |||
for kn in self.d[iface].keys(): | |||
out['%s%s.%s' % (prefix, iface, kn)] = int(self.d[iface][kn]) | |||
return out | |||
def main(): | |||
s = Client('localhost',8125) | |||
n = LinuxNetStats() | |||
for k,v in n.forStatsd(prefix='host.com.eeqj.net.').items(): | |||
s.update_stats(k,v) | |||
if __name__=="__main__": | |||
main() |
@@ -12,6 +12,10 @@ from ofxclient.request import Builder as OFXClientBuilder | |||
from scraper import FinancialScraper, MockInstitution | |||
class AmexScraper(FinancialScraper): | |||
def isBank(self): | |||
return False | |||
def isCC(self): | |||
return True | |||
def getInstitution(self): | |||
return MockInstitution( | |||
user=self.user, |
@@ -10,6 +10,10 @@ import json | |||
from scraper import FinancialScraper, MockInstitution | |||
class EtradeScraper(FinancialScraper): | |||
def isBank(self): | |||
return True | |||
def isCC(self): | |||
return False | |||
def getInstitution(self): | |||
return MockInstitution( | |||
user=self.user, |
@@ -4,6 +4,7 @@ | |||
# 2013 jeffrey paul <sneak@datavibe.net> | |||
# 5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2 | |||
from pprint import pformat | |||
import os | |||
import re | |||
from ofxclient.request import Builder as OFXClientBuilder | |||
@@ -32,8 +33,12 @@ class FinancialScraper(object): | |||
out = {} | |||
for acctnum in re.findall(c,r): | |||
out[acctnum] = {} | |||
print(pformat(out)) | |||
c = re.compile(r'<BALAMT>([\d\.\-]+)', re.MULTILINE) | |||
for acctnum in out.keys(): | |||
r = b.doQuery(b.ccQuery(acctnum,'19700101000000')) | |||
if self.isCC(): | |||
r = b.doQuery(b.ccQuery(acctnum,'19700101000000')) | |||
if self.isBank(): | |||
r = b.doQuery(b.baQuery(acctnum,'19700101000000','','')) | |||
out[acctnum]['balance'] = re.findall(c,r)[0] | |||
return out |