<commit_before>#!/bin/lua

if arg[6] == nil then
    print("Usage: ./timetable.lua start:year start:month start:day end:year end:month end:day")
    return
end

os.execute("killall wget &> /dev/null")
os.execute("./timetable_helper.sh")

local skip = true

function string.starts(String,Start)
    return string.sub(String,1,string.len(Start))==Start
end

function string:split(sep)
    local sep, fields = sep or ":", {}
    local pattern = string.format("([^%s]+)", sep)
    self:gsub(pattern, function(c) fields[#fields+1] = c end)
    return fields
end


local entries = {}
local index = 0
local cursor = 0
local startdate = os.time{ year=arg[1], month=arg[2], day=arg[3], hour=0, minute=0, second=0 }
local enddate = os.time{ year=arg[4], month=arg[5], day=arg[6], hour=23, minute=59, second=59 }

for line in io.lines("timetable_data") do
    if string.starts(line, "ourEventId:") then
        skip = false
    end

    if skip == false then
        if cursor == 0 then
            if string.starts(line, "moduleDesc:") then
                entries[index] = {}
                entries[index][cursor] = line:sub(14, #line - 3)
                cursor = cursor + 1
            end
        elseif cursor == 1 then
            if string.starts(line, "room:") then<commit_msg>added some useful command argument parsing<commit_after>#!/bin/lua

local startdate
local enddate

if arg[1] == "today" then
    startdate = os.date("*t")
    startdate.hour = 0
    startdate.min = 0
    startdate.sec = 0
    startdate = os.time(startdate)
    enddate = os.date("*t")
    enddate.hour = 23
    enddate.min = 59
    enddate.sec = 59
    enddate = os.time(enddate)
elseif arg[1] == "tomorrow" then
    startdate = os.date("*t")
    startdate.day = startdate.day + 1
    startdate.hour = 0
    startdate.min = 0
    startdate.sec = 0
    startdate = os.time(startdate)
    enddate = os.date("*t")
    enddate.day = enddate.day + 1
    enddate.hour = 23
    enddate.min = 59
    enddate.sec = 59
    enddate = os.time(enddate)
elseif arg[1] == "nextweek" then
    startdate = os.date("*t")
    startdate.hour = 0
    startdate.min = 0
    startdate.sec = 0
    startdate = os.time(startdate)
    enddate = os.date("*t")
    enddate.day = enddate.day + 7
    enddate.hour = 23
    enddate.min = 59
    enddate.sec = 59
    enddate = os.time(enddate)
elseif arg[6] ~= nil then
    startdate = os.time{ year=arg[1], month=arg[2], day=arg[3], hour=0, minute=0, second=0 }
    enddate = os.time{ year=arg[4], month=arg[5], day=arg[6], hour=23, minute=59, second=59 }
else
    print("Usage: ./timetable.lua start:year start:month start:day end:year end:month end:day")
    return
end


os.execute("killall wget &> /dev/null")
os.execute("./timetable_helper.sh")

local skip = true

function string.starts(String,Start)
    return string.sub(String,1,string.len(Start))==Start
end

function string:split(sep)
    local sep, fields = sep or ":", {}
    local pattern = string.format("([^%s]+)", sep)
    self:gsub(pattern, function(c) fields[#fields+1] = c end)
    return fields
end


local entries = {}
local index = 0
local cursor = 0

for line in io.lines("timetable_data") do
    if string.starts(line, "ourEventId:") then
        skip = false
    end

    if skip == false then
        if cursor == 0 then
            if string.starts(line, "moduleDesc:") then
                entries[index] = {}
                entries[index][cursor] = line:sub(14, #line - 3)
                cursor = cursor + 1
            end
        elseif cursor == 1 then
            if string.starts(line, "room:") then
{'fraction_non_alphanumeric': 0.14353532532812063, 'fraction_numerical': 0.023736386484222285, 'mean_word_length': 2.7985153764581123, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, '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': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2916962', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1218, 'n_words': 314}