<commit_before>"""
Author: <NAME> <<EMAIL>>
Copyright (c) 2015 <NAME>

Description: This script will post a message on your slack channel
Please configure your `/etc/brainy-beats.cfg` file first.

Example brainy-beats.cfg

[slack]
url=https://hooks.slack.com/services/XxXxXxXxXx
channel=botwa
icon_emoji=ghost
username=beats-bot
"""

from subprocess import call
import sys
import json
import ConfigParser

def payload(text, conf):
	toPost = {
		"channel": "#" + conf.get("slack", "channel"),
		"username": conf.get("slack", "username"),
		"text": text,
		"icon_emoji": ":" + conf.get("slack", "icon_emoji") + ":"
	}
	return "payload=" + json.dumps(toPost)

def main():
	CONFIG_FILE = '/etc/slack_post.cfg'
	# read configuration 
	conf = ConfigParser.ConfigParser()
	conf.read(CONFIG_FILE)

	call([
		"curl",
		"-X",
		"POST",
		"--data-urlencode",
		payload(sys.argv[1], conf),
		conf.get("slack", "url")
		])

if __name__ == '__main__':
	main()<commit_msg>FIX - path of .cfg file corrected<commit_after>"""
Author: <NAME> <<EMAIL>>
Copyright (c) 2015 <NAME>

Description: This script will post a message on your slack channel
Please configure your `/etc/brainy-beats.cfg` file first.

Example brainy-beats.cfg

[slack]
url=https://hooks.slack.com/services/XxXxXxXxXx
channel=botwa
icon_emoji=ghost
username=beats-bot
"""

from subprocess import call
import sys
import json
import ConfigParser

def payload(text, conf):
	toPost = {
		"channel": "#" + conf.get("slack", "channel"),
		"username": conf.get("slack", "username"),
		"text": text,
		"icon_emoji": ":" + conf.get("slack", "icon_emoji") + ":"
	}
	return "payload=" + json.dumps(toPost)

def main():
	CONFIG_FILE = '/etc/brainy-beats.cfg'
	# read configuration 
	conf = ConfigParser.ConfigParser()
	conf.read(CONFIG_FILE)

	call([
		"curl",
		"-X",
		"POST",
		"--data-urlencode",
		payload(sys.argv[1], conf),
		conf.get("slack", "url")
		])

if __name__ == '__main__':
	main()
{'fraction_non_alphanumeric': 0.17510330578512398, 'fraction_numerical': 0.005165289256198347, 'mean_word_length': 4.66374269005848, 'pattern_counts': {'":': 12, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '3169034', 'n_tokens_mistral': 766, 'n_tokens_neox': 722, 'n_words': 168}