Skip to content

Instantly share code, notes, and snippets.

@anaisbetts
Created July 24, 2011 18:20
Show Gist options
  • Select an option

  • Save anaisbetts/1102901 to your computer and use it in GitHub Desktop.

Select an option

Save anaisbetts/1102901 to your computer and use it in GitHub Desktop.
var grouped = input.GroupBy(x => x.Login);
var loginTimes = grouped.Select(x => {
return x.Window(x, _ => Observable.Empty<Unit>().Delay(TimeSpan.FromMinutes(5), sched))
.SelectMany(y => y.Count())
.Select(n => new { Login = x.Key, Times = n });
}).Merge();
loginTimes.Where(x => x.Times > 2)
.Select(x => String.Format("Bad user {0}!", x.Login))
.Timestamp(sched)
.Dump();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment