gophergala2016/daemon

Name: daemon

Owner: gophergala2016

Description: Thought expirement to create a simple process which would scan live news feeds to hit on pre-conceived criterion which would then trigger a series of events.

Created: 2016-01-23 02:31:46.0

Updated: 2016-01-24 19:25:10.0

Pushed: 2016-01-24 21:07:58.0

Homepage: https://www.revolvingcow.com

Size: 4812

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

wercker status

Daemon

Objective

Thought expirement to create a simple process which would scan live news feeds to hit on pre-conceived criterion which would then trigger a series of events. The idea came from the recent re-read of “Daemon” by Daniel Saurez

hew Sobol was a legendary computer game designer?the architect behind half a dozen popular online games.
premature death from brain cancer depressed both gamers and his company?s stock price. But Sobol?s fans
n?t the only ones to note his passing. He left behind something that was scanning Internet obituaries,
? something that put in motion a whole series of programs upon his death. Programs that moved money.
rams that recruited people. Programs that killed.

ronted with a killer from beyond the grave, Detective Peter Sebeck comes face-to-face with the full
ications of our increasingly complex and interconnected world?one where the dead can read headlines,
l identities, and carry out far-reaching plans without fear of retribution. Sebeck must find a way to
 Sobol?s web of programs?his Daemon?before it achieves its ultimate purpose. And to do so, he must
ver what that purpose is...
The nasty bits
daemon

The daemon is a simple process started by `daemon run`. Essentially it is the scheduler for all other processes internal to the application set to go off in regular intervals. The primary focus was to create a reproducible environment manageming any environment variables and other management tasks.

scour

scour will take a newline delimited file of RSS 2.0 or Atom feeds and look for matching stories. The matching logic is very basic but may be later expanded to give more flexibility. If it detects a match then the story is piped to the scourge command.

scourge

The last piece of the puzzle is scourge. Its intent is to take a story which was a successfuly hit and to execute the appropriate response. The response is in the form of chained commands which are executed on the system.

Stories

Story files were created to drive the match/hit processes as well as the associated responses. The format for a story can be seen with the example of :


ncluded": ["gopher", "gala"],
xcluded": ["game"],
riggers": [{
"command": "touch",
"arguments": ["gophers-unite"],
"wait": false


To qualify as a successful match all of the terms in the included array must be contained in the title or description of the article. Also, the terms in the excluded array must not be found within either of those sections. Once it has been determined a match then the array of triggers will be ran.

Compiling a list of feeds

The current list of feeds is actually a good starting place. These are compiled from the following sources:

However, you can change the news feeds at runtime by setting the environment variable for `DAEMON_FEEDS` to any file. The only requirement is to place each URI on its own line. For example, for some testing we used a much smaller list and only included the following feeds:

://golangweekly.com/rss/17nm799j
Use cases

Besides being an experiment of what can be done in a weekend this could actually have some interesting uses.

  1. Time sensitive reactions to current events
  2. Dynamic story lines in gaming
  3. Interesting workflows in the work environment
  4. Taking over the world
Example

daemon in action

With this arbitrary example we pull down the latest and greatest and then modify the story to and watch as it hits on a news item and sends a notification to dunst displaying in the top-right corner.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.