Skip to content

Instantly share code, notes, and snippets.

@AaronJackson
Created April 2, 2015 00:23
Show Gist options
  • Save AaronJackson/c3ccabf77a7e229381ce to your computer and use it in GitHub Desktop.
Save AaronJackson/c3ccabf77a7e229381ce to your computer and use it in GitHub Desktop.
MATLAB Visualise Sent Email - 24 Hour Clock
clear all
close all
clc
% dump from zimbra and run
% grep -r "^Date: " ./Sent* > Sent.list
regs = ...
['(?<day_named>(Mon|Tue|Wed|Thu|Fri|Sat|Sun))' ',\s' ...
'(?<day>[0-9][0-9]*)' '\s' ...
'(?<month>(Jan|Feb|Mar|Apr|Jun|Jul|Aug|Sep|Oct|Nov|Dec))' '\s' ...
'(?<year>[0-9][0-9][0-9][0-9])' '\s' ...
'(?<hours>[0-9][0-9])' '[:]' ...
'(?<minutes>[0-9][0-9])' '[:]' ...
];
sent = [];
fid = fopen('Sent.list', 'r');
l = '';
while true
l = [fgetl(fid)];
if ~ischar(l), break, end
sent = [ sent ; regexp(l, regs, 'names') ];
end
fclose(fid);
counts = hist(str2num(char(sent.hours)), 24);
figure, hold on, axis square off
for n=0:0.001:2*pi
h = floor((n/(2*pi))*24)+1;
shade = counts(h)/max(counts);
plot([0 sin(n)], [0 cos(n)], '-', 'LineWidth', 2, ...
'Color', [shade 1-shade 1-shade])
end
hour = 0;
for n=linspace(0,23,24)/24*2*pi
text(sin(n+0.15)*1.1, cos(n+0.15)*1.1, num2str(hour))
plot([0 sin(n)*1.1], [0 cos(n)*1.1], 'k-')
hour = hour + 1;
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment