just needs a better algorithm, this one I coded today very quickly and there's a loooot of room for improvement (like right now I'm not clustering your activity when determining the times you were active at)
also, the window size I'm using is very short because I wanted to find more events that would fit in the "inactive window", right now it's set at 30 seconds or something like that