updates, I think
This commit is contained in:
parent
09e8aeb5c0
commit
05978c6c18
|
@ -14,6 +14,8 @@ log.split("\n").each do |line|
|
|||
request = parsed['%r'].split(" ")[1]
|
||||
bytes = parsed['%b'].to_i
|
||||
status = parsed['%>s']
|
||||
|
||||
next if request == nil
|
||||
|
||||
user = request[1]
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
RES_BASE = "https://strawberry.thedevcave.net/~christoffermadsen/"
|
||||
USERNAMES = ["christoffermadsen","jmaa","jacob","alexander"]
|
||||
NAMES_SHO = {"c" => "christoffermadsen", "j" => "jmaa", "h" => "jacob", "a" => "alexander"}
|
||||
SHOT_DIR = "/var/shots/"
|
||||
ERB_FILE = "dcav-index.erb"
|
||||
HTML_FILE = "/var/shots/html/index.html"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
%>
|
||||
<% end %>
|
||||
</table>
|
||||
<br><i>Bandwidth logged since 2017-05-23</i>
|
||||
<h2>Charts</h2>
|
||||
<img src=<%="#{RES_BASE}img/screenshot_count.svg"%> />
|
||||
<br />
|
||||
|
|
18
pieplot.py
18
pieplot.py
|
@ -1,17 +1,21 @@
|
|||
import json
|
||||
import matplotlib as mpl
|
||||
mpl.use('svg')
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
users = ['alexander','christoffermadsen','jmaa','jacob']
|
||||
numbers = {}
|
||||
for user in users:
|
||||
number = open("log/" + user + ".log", "r").read().split("\n")[-2].split(" ")[1]
|
||||
numbers[user] = number
|
||||
shot_counts = {}
|
||||
shot_bandwidth = json.loads(open("log/bandwidth.dat", "r").read())
|
||||
|
||||
values = list(numbers.values())
|
||||
labels = list(numbers.keys())
|
||||
for user in users:
|
||||
shot_counts[user] = open("log/" + user + ".log", "r").read().split("\n")[-2].split(" ")[1]
|
||||
|
||||
fig1, ax1 = plt.subplots()
|
||||
ax1.pie(values,labels=labels,autopct="%1.1f%%", shadow=True, startangle=90)
|
||||
ax1.pie(list(shot_counts.values()),labels=list(shot_counts.keys()),autopct="%1.1f%%", shadow=True, startangle=90)
|
||||
ax1.axis('equal')
|
||||
plt.savefig("/home/christoffermadsen/public_html/img/dcavpie.svg", format="svg")
|
||||
|
||||
#fig2, ax2 = plt.subplots()
|
||||
#plt.figure(fig2.number)
|
||||
#plt.bar(list(shot_bandwidth.keys()), list(shot_bandwidth.values()))
|
||||
#plt.savefig("/home/christoffermadsen/public_html/img/dcavbandwidth.svg", format="svg")
|
||||
|
|
Loading…
Reference in New Issue
Block a user