<commit_before># Stats
Stats/Analytics generator for IRC and Slack channels

### Demos
* [Aligned Pixels, Ink. 🏇](https://kash.im/stats/aligned.html) ([Slack group](http://alignedpixels.com/), four channels)
* [Designer Network](https://kash.im/stats/dn.html) ([IRC channel](http://designers.im/))
* [NYCTech](https://kash.im/stats/nyctech.html) ([Slack Group](http://www.nyctechslack.com/), one channel)
* [Spec.fm](https://kash.im/stats/spec.html) ([Slack group](http://spec.fm/), one channel)

Slack provides a stats page of their own at `https://<group>.slack.com/stats` ([Example output from NYCTech](https://i.imgur.com/CUDfoPx.png))

### Usage

This script assumes your logs are formatted like so

```
[2006-01-02 15:04:05 -0700] <joebloggs> This is a message
[2006-01-02 15:04:05 -0700] * joebloggs is preforming an action
```

#### Basic usage

Edit `config.yaml` and set `:location`to your log file, then run `stats.rb`. This will create a `database.json` and `stats.html` in the script directoy.

#### Example config

```yaml
# Full path to your log file or directory (mandatory)
:location: "/home/Alice/irc/logs/#channel.log"

# Full path to generated .html file
:save_location: /var/www/example.com/stats.html

# Full path to database file
:database_location: /var/www/example.com/database.json

# Page info in the header of generated .html
:title: Some Channel
:description: Some Channel is some channel on some network

# The interval (distance between numbers) for the scale on the days heatmap. Integer
:heatmap_interval: 50

# Ignore list
:ignore:
  - somebot
  - otherbot
<commit_msg>linking a gist<commit_after># Stats
Stats/Analytics generator for IRC and Slack channels

### Demos
* [Aligned Pixels, Ink. 🏇](https://kash.im/stats/aligned.html) ([Slack group](http://alignedpixels.com/), four channels)
* [Designer Network](https://kash.im/stats/dn.html) ([IRC channel](http://designers.im/))
* [NYCTech](https://kash.im/stats/nyctech.html) ([Slack Group](http://www.nyctechslack.com/), one channel)
* [Spec.fm](https://kash.im/stats/spec.html) ([Slack group](http://spec.fm/), one channel)

Slack provides a stats page of their own at `https://<group>.slack.com/stats` ([Example output from NYCTech](https://i.imgur.com/CUDfoPx.png))

### Usage

This script assumes your logs are formatted like so

```
[2006-01-02 15:04:05 -0700] <joebloggs> This is a message
[2006-01-02 15:04:05 -0700] * joebloggs is preforming an action
```

Take a look at [this gist](https://gist.github.com/0x263b/a296fad860edc4ea3deb7f30e0e41bc0) for how to obtain logs from Slack

#### Basic usage

Edit `config.yaml` and set `:location`to your log file, then run `stats.rb`. This will create a `database.json` and `stats.html` in the script directoy.

#### Example config

```yaml
# Full path to your log file or directory (mandatory)
:location: "/home/Alice/irc/logs/#channel.log"

# Full path to generated .html file
:save_location: /var/www/example.com/stats.html

# Full path to database file
:database_location: /var/www/example.com/database.json

# Page info in the header of generated .html
:title: Some Channel
:description: Some Channel is some channel on some network

# The interval (distance between numbers) for the scale on the days heatmap. Integer
:heatmap_interval: 50

# Ignore list
:ignore:
  - somebot
  - otherbot

{'fraction_non_alphanumeric': 0.14487102579484104, 'fraction_numerical': 0.028494301139772044, 'mean_word_length': 4.494233937397035, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 13, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2287909', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1117, 'n_words': 345}