<commit_before>-- app-chanop: irc chanop bot
-- Copyright (C) 2014 daneos.
-- Released under the MIT license. See LICENSE for details

local bot = require "bot"

local function locator(lat,lon)

--
	local lengthofloc = 6
--

-- we add some degrees

	lon = lon + 180
	lat = lat + 90

-- to fix the coords

	local qth = {}

	qth[1] = string.char( string.byte("A") + math.floor(lon / 20) )
	qth[2] = string.char( string.byte("A") + math.floor(lat / 10) )

	qth[3] = string.char( string.byte("0") + math.floor((lon % 20)/2))
	qth[4] = string.char( string.byte("0") + math.floor((lat % 10)/1))

	qth[5] = string.char( string.byte("A") + math.floor( (lon - (math.floor(lon/2)*2)) / (5/60)))
	qth[6] = string.char( string.byte("A") + math.floor( (lat - (math.floor(lat/1)*1)) / (2.5/60)))


-- Above is some discrete shit (floor of floor or roof of longitude and latitude - but it's half past four when i write this code.
-- I'll figure what should it be later. Seriously ;) If you see that and it's not fixed, write me an issue
-- TODO: refactor countings, code another level of qth locator, smaller than 3rd one.

	local loc = qth[1]
	for i=2,lengthofloc do loc = (loc .. qth[i]) end

	return loc
end

local function auth(nick, key, pass)
-- this is only dummy function
	return true
end

local hooks = {
	["OnChat"] = function(user, channel, message)
		bot:sendChat(bot.chans.global, "["..channel.."] "..user.nick..": "..message)
		
		if channel == bot.chans.announce then
			local key,lat,lon,action,pass = message:match("%[(%x+)%@(%d+%.%d+%u)(%d+%.%d+%u)%](%u+) (.+)")
			if not key or not lat or not lon or not action or not pass then
				bot:sendChat(bot.chans.announce, user.nick..":SYNTAX ERROR")
				bot:debug("Syntax error on "..channel.." from "..user.nick)
				return
			end 
			bot:debug("["..channel.."] "..user.nick..": KEY="..key.." LAT="..lat.." LON="..lon.." ACTION="..action.." PASS="..pass)<commit_msg>Tidied some calculations<commit_after>-- app-chanop: irc chanop bot
-- Copyright (C) 2014 daneos.
-- Released under the MIT license. See LICENSE for details

local bot = require "bot"

local function locator(lat,lon)

--
	local lengthofloc = 6
--

-- we add some degrees

	lon = lon + 180
	lat = lat + 90

-- to fix the coords

	local qth = {}

	qth[1] = string.char( string.byte("A") + math.floor(lon / 20) )
	qth[2] = string.char( string.byte("A") + math.floor(lat / 10) )

	qth[3] = string.char( string.byte("0") + math.floor((lon % 20)/2))
	qth[4] = string.char( string.byte("0") + math.floor((lat % 10)/1))

	qth[5] = string.char( string.byte("A") + math.floor( 12 * (x-2*math.floor(x/2)) )
	qth[6] = string.char( string.byte("A") + math.floor( 24 * (x - math.floor(x)) )


-- TODO: code another level of qth locator, smaller than 3rd one.

	local loc = qth[1]
	for i=2,lengthofloc do loc = (loc .. qth[i]) end

	return loc
end

local function auth(nick, key, pass)
-- this is only dummy function
	return true
end

local hooks = {
	["OnChat"] = function(user, channel, message)
		bot:sendChat(bot.chans.global, "["..channel.."] "..user.nick..": "..message)
		
		if channel == bot.chans.announce then
			local key,lat,lon,action,pass = message:match("%[(%x+)%@(%d+%.%d+%u)(%d+%.%d+%u)%](%u+) (.+)")
			if not key or not lat or not lon or not action or not pass then
				bot:sendChat(bot.chans.announce, user.nick..":SYNTAX ERROR")
				bot:debug("Syntax error on "..channel.." from "..user.nick)
				return
			end 
			bot:debug("["..channel.."] "..user.nick..": KEY="..key.." LAT="..lat.." LON="..lon.." ACTION="..action.." PASS="..pass)
{'fraction_non_alphanumeric': 0.1991561181434599, 'fraction_numerical': 0.022222222222222223, 'mean_word_length': 3.2740384615384617, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 1, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1236259', 'n_tokens_mistral': 1444, 'n_tokens_neox': 1307, 'n_words': 378}