local TimerPlans = {} function TimerPlanCalendar:new(o) o = o or {} setmetatable(o, self) self.__index = self return o end function TimerPlans:makeJson() local JSON_TEMP_PATH = "/tmp/log/" local url = 'https://127.0.0.1:8090/json.htm?type=command¶m=gettimerplans' local jsonFile = JSON_TEMP_PATH .. 'timerplan' .. '.json' --domoticz.log('Getting .ics file ' .. self.name .. '...', domoticz.LOG_INFO) --domoticz.log('URL used: '.. url, domoticz.LOG_DEBUG) --os.execute('curl -s "' .. url ..'" > ' .. jsonFile ..'&type=json') print (url) print (jsonFile) return end -------------------------------------------------------------------------------- local TimerPlanCalendar = { name = "" , url = "" } function TimerPlanCalendar:new(o) o = o or {} setmetatable(o, self) self.__index = self return o end function TimerPlanCalendar:getName() return self.name end function TimerPlanCalendar:getUrl() return self.url end function TimerPlanCalendar:makeJson() local JSON_TEMP_PATH = "/tmp/log/" local url = 'https://dashticz.nl/ical/' url = 'https://ical-to-json.herokuapp.com/convert.json' url = url .. '?url=' url = url .. self.url local jsonFile = JSON_TEMP_PATH .. self.name .. '.json' --domoticz.log('Getting .ics file ' .. self.name .. '...', domoticz.LOG_INFO) --domoticz.log('URL used: '.. url, domoticz.LOG_DEBUG) --os.execute('curl -s "' .. url ..'" > ' .. jsonFile ..'&type=json') print (url) print (jsonFile) return end -------------------------------------------------------------------------------- local DomoticzTimerPlanCalendar = { calendars = {} , availableTimerPlans = {} , } function DomoticzTimerPlanCalendar:new () o = o or {} setmetatable(o, self) self.__index = self self.availableTimerPlans = {"aaa", "bbbb", "cccc"} return o end function DomoticzTimerPlanCalendar:addCalendar(cal) table.insert(self.calendars, cal) end function DomoticzTimerPlanCalendar:getAvailableTimerPlans() return self.availableTimerPlans end function DomoticzTimerPlanCalendar:getCalendars() for i, c in ipairs(self.calendars) do print(c.Name) end return end ---------------------------------- main ---------------------------------------- myDomoticzTimerPlanCalendar = DomoticzTimerPlanCalendar:new() myTimerPlanCalendar1 = TimerPlanCalendar:new{name = "private", url = "https://private"} myTimerPlanCalendar2 = TimerPlanCalendar:new{name = "camera", url = "https://camera"} myDomoticzTimerPlanCalendar:addCalendar(myTimerPlanCalendar1) myDomoticzTimerPlanCalendar:addCalendar(myTimerPlanCalendar2) print(myTimerPlanCalendar1:getName()) print(myTimerPlanCalendar2:getUrl()) myTimerPlanCalendar1:makeJson()
------------ Base Object -------------- Base = { className = "Base", instanceName = "" } mtClass={} mtClass.__index={ getClassName=function(self) return self.className end, getInstanceName=function(self) return self.instanceName end, new=function(self, t) t.base = self return setmetatable(t,{__index=self}) end, getBase = function(self) return self.base end, inherit=function (self,t,methods) t.base = self local mtnew={__index=setmetatable(methods,{__index=self})} return setmetatable(t or {},mtnew) end } setmetatable(Base,mtClass) local jAGScheduler = Base:inherit( {className = 'jAGScheduler'} , { New = function(self, name, logFile) print('self class' .. self:getClassName()) local newClass = self:new({ instanceName = name , scrptPth = 'scriptPath()' , threads = {} }) return newClass end } ) local newApp = jAGScheduler.New('Sample') print('Scheduler Instance ' .. newApp:getInstanceName())
function buildMinAndDecimalMin(val) val = round(val * 60, 3) local rtn = string.format("%02d", math.floor(val)) rtn = rtn .. "." .. string.sub(string.format("%3f", val - math.floor(val)), 3, 5) return rtn end function round(num, idp) local mult = 10 ^ (idp or 0) return math.floor(num * mult + 0.5) / mult end AAAAAA = 691152; BBBBBB = 543803; CCCCCC = 874620; varC = CCCCCC; varB = BBBBBB; varA = AAAAAA; if (varA % 1000 - varA % 100) / 100 == 1 then varLatVorz = 1 varLongVorz = 1 elseif (varA % 1000 - varA % 100) / 100 == 2 then varLatVorz = -1 varLongVorz = 1 elseif (varA % 1000 - varA % 100) / 100 == 3 then varLatVorz = 1 varLongVorz = -1 elseif (varA % 1000 - varA % 100) / 100 == 4 then varLatVorz = -1 varLongVorz = -1 end if ((varC % 100000 - varC % 10000) / 10000 + (varC % 100 - varC % 10) / 10) % 2 == 0 then varLatKOMP = tonumber(varLatVorz * ((varA % 10000 - varA % 1000) / 1000 * 10 + (varB % 100 - varB % 10) / 10 + (varB % 100000 - varB % 10000) / 10000 * 0.1 + (varC % 1000 - varC % 100) / 100 * 0.01 + (varA % 1000000 - varA % 100000) / 100000 * 0.001 + (varC % 100 - varC % 10) / 10 * 1.0E-4 + varA % 10 * 1.0E-5)) elseif ((varC % 100000 - varC % 10000) / 10000 + (varC % 100 - varC % 10) / 10) % 2 ~= 0 then varLatKOMP = tonumber(varLatVorz * ((varB % 1000000 - varB % 100000) / 100000 * 10 + varA % 10 + (varA % 10000 - varA % 1000) / 1000 * 0.1 + (varC % 1000000 - varC % 100000) / 100000 * 0.01 + (varC % 1000 - varC % 100) / 100 * 0.001 + (varC % 100 - varC % 10) / 10 * 1.0E-4 + (varA % 1000000 - varA % 100000) / 100000 * 1.0E-5)) end if ((varC % 100000 - varC % 10000) / 10000 + (varC % 100 - varC % 10) / 10) % 2 == 0 then varLongKOMP = tonumber(varLongVorz * ((varA % 100000 - varA % 10000) / 10000 * 100 + (varC % 1000000 - varC % 100000) / 100000 * 10 + varC % 10 + (varB % 1000 - varB % 100) / 100 * 0.1 + (varB % 1000000 - varB % 100000) / 100000 * 0.01 + (varA % 100 - varA % 10) / 10 * 0.001 + (varC % 100000 - varC % 10000) / 10000 * 1.0E-4 + varB % 10 * 1.0E-5)) elseif ((varC % 100000 - varC % 10000) / 10000 + (varC % 100 - varC % 10) / 10) % 2 ~= 0 then varLongKOMP = tonumber(varLongVorz * ((varB % 100 - varB % 10) / 10 * 100 + varC % 10 * 10 + (varA % 100 - varA % 10) / 10 + (varA % 100000 - varA % 10000) / 10000 * 0.1 + (varB % 1000 - varB % 100) / 100 * 0.01 + varB % 10 * 0.001 + (varC % 100000 - varC % 10000) / 10000 * 1.0E-4 + (varB % 100000 - varB % 10000) / 10000 * 1.0E-5)) end print(varLatKOMP); print(varLongKOMP); lat = tonumber(varLatKOMP) lon = tonumber(varLongKOMP) local str_lat = "" local str_lon = "" if lat >= 0 then str_lat = "N" else str_lat = "S" lat = lat * -1 end local tmp = math.floor(lat) str_lat = str_lat .. " " .. string.format("%02d", tmp) .. " " str_lat = str_lat .. buildMinAndDecimalMin(lat - tmp) if lon >= 0 then str_lon = "E" else str_lon = "W" lon = lon * -1 end tmp = math.floor(lon) str_lon = str_lon .. " " .. string.format("%03d", tmp) .. " " str_lon = str_lon .. buildMinAndDecimalMin(lon - tmp) print (str_lat); print(str_lon);
math.randomseed( os.time() ) local code = "code" local poetry = "poetry" local function sometimes( arg1, modifier, arg2 ) local output = "sometimes " .. arg1 .. " " .. modifier if type( arg2 ) == "string" then output = output .. " " .. arg2 end if modifier == "is" then if math.random( 0, 1 ) == 1 then code = arg2 end elseif modifier == "isn't" then io.write( "\n" ) end print( output ) end local it local is = { made = {} } function is.made.with( arg ) print( "it is made with " .. arg .. "\n" ) end local isMetatable = {} function isMetatable.__call( index, ... ) local arg = ... print( "simplicity is " .. tostring( arg ) ) code = function( ... ) print( "code " .. table.concat( { ... }, " " ) ) io.write( "\n" ) end return "simplicity" end setmetatable( is, isMetatable ) local simplicity local function isReused( arg ) return "is reused " .. arg end local function ironically( text ) print( "ironically" ) print( text ) end local run = load local function we( arg ) if type( arg ) == "function" then arg() return true elseif type( arg ) == "string" then print( "we " .. arg ) end end local something = "something" local function get( arg ) return "get " .. tostring( arg ) end local runNext local function pretty() runNext = function() io.write( "\n" ) print( "this hides its meaning, like poetry often does" ) print( "but there is no ambiguity to the computer" ) end return "pretty" end local function but( ... ) print( "but " .. table.concat( { ... }, " " ) ) runNext() end local function readPoem( name, author ) print( name .. " by " .. author ) io.write( "\n" ) local poem = _G[ name ] if type( poem ) == "function" then poem() end end function codeAsPoetry() sometimes( code, "is", poetry ) if code == poetry then it = is.made.with( "restraint" ) simplicity = is( "valued" ) code( isReused( "to achieve" ), simplicity ) ironically( "this program, I would argue, is not poetic" ) else sometimes( "it", "isn't" ) -- I wouldn't call this poetry local this = "\112\114\105\110\116\040\034\092\110\073\032\119\111\117\108\100\110\039\116\032\099\097\108\108\032\116\104\105\115\032\112\111\101\116\114\121\092\110\034\041\059\112\114\105\110\116\040\034\116\104\105\115\032\105\115\032\109\101\115\115\121\034\041\059\112\114\105\110\116\040\034\092\116\111\118\101\114\045\099\111\109\112\108\105\099\097\116\101\100\034\041\059\112\114\105\110\116\040\034\092\110\092\116\092\116\121\101\116\032\111\098\115\099\117\114\101\100\092\110\034\041" if we( run( this ) ) then we( get( something ) .. " out" ) end but( "it", "isn't", pretty() ) -- this hides its meaning, like poetry often does -- but there is no ambiguity to the computer end end readPoem( "codeAsPoetry", "Julian Montague" )
local spawnpoints = { {1, 2207.3999, 1285.9, 10.8}, {2, 2030, 1914.3, 12.3}, {3, 2024.9004, 1104.7998, 10.8}, {4, 1954.5, 1343.0996, 15.4}, {5, 2026.7002, 1545.5, 10.8}, {6, 2550.2, 1962.4, 10.8}, {7, 2166.7002, 2012.2998, 10.8}, {8, 2369.6006, 2044.4004, 10.8}, {9, 2532.7, 1507.7, 11.8}, {10, 2481.3999, 1525.4, 11.8}, {11, 2451.1001, 1301.9, 10.8}, {12, 2180.5, 1118.2, 12.6}, {13, 2507.5, 1243.9, 10.8}, {14, 2419.6001, 1123.4, 10.8}, {15, 1937.1, 1081.7, 10.8}, {16, 2032.4004, 995.7998, 10.8}, {17, 1098.3, 1615.7, 12.5}, {18, 1674.2998, 1447.7998, 10.8}, {19, 1607.4004, 1816.5996, 10.8}, {20, 1166.8, 1364.4, 10.8}, {21, 1355.2, 2581.3999, 10.8}, {22, 1161.5, 2100.2998, 11.1}, {23, 1457.6, 2665.8, 10.8}, {24, 1670.4, 2596.7, 10.8}, {25, 1417.0996, 2611.1006, 10.8}, {26, 2067.7, 2734.7, 10.8}, {27, 2094.5, 2653.7002, 10.8}, {28, 2288.2, 2425.8, 10.8}, {29, 2360.3, 2380.6001, 10.8}, {30, 2336.7002, 2455, 15}, {31, 2368.3, 2124.5, 10.8}, {32, 2317, 2289.7998, 10.8}, {33, 2327.5, 2118.7998, 10.8}, {34, 2624, 2342.6001, 10.8}, {35, 2505.9004, 2125.4004, 10.8}, {36, 2577.2002, 2225.1006, 10.8}, {37, 2570.2, 2367.8, 17.8}, {38, 2783.1001, 2446.3, 11.1}, {39, 2899.1001, 2303.3999, 10.8}, {40, 2809.2, 1979.3, 10.8}, {41, 2786, 1455, 10.8}, {42, 2849.2, 1289.9, 11.4}, {43, 2746.8, 905.40002, 10.9}, {44, 2597.7, 759.90002, 11}, {45, 2367.1001, 705.90002, 10.8}, {46, 1560.2, 773.40002, 10.8}, {47, 2237.2002, 706.09961, 10.8}, {48, 1500, 923, 10.8}, {49, 1324.6, 1186.9, 10.8}, {50, 1514.7002, 1102.5, 10.8}, {51, 1323.1, 1186.9, 10.8}, {52, 1049.7, 1013.8, 11}, {53, 1020.9, 1059.8, 11}, {54, 1088.7002, 1003, 11}, {55, 944.40002, 1733, 8.9}, {56, 999.79999, 1872.9, 10.8}, {57, 1000.4, 1933, 10.8}, {58, 1089.2, 2285.6001, 10.8}, {59, 1000.0996, 2082.9004, 10.8}, {60, 1000.5, 2272.9004, 10.8}, {61, 1240.2, 2600, 10.8}, {62, 1460.7, 2763.3999, 10.8}, {63, 1496.5, 2773.5, 10.8}, {64, 1749.3, 2797.8999, 10.8}, {65, 1794.6, 2839.2, 10.8}, {66, 1772.8, 2757.8999, 10.8}, {67, 2125.2, 2460.7, 10.8}, {68, 1811.4004, 2721.1006, 10.8}, {69, 2208.3, 2363.2, 10.8}, {70, 2128, 2361, 10.8}, {71, 1920.1, 2153.7, 10.8}, {72, 1919.5, 2052.7, 10.8}, {73, 1847.7, 2045.8, 10.9}, {74, 1719, 2162, 10.8}, {75, 1785.5996, 2117.9004, 11}, {76, 1587.7, 2181, 10.8}, {77, 1657.7002, 2180.9004, 10.8}, {78, 1610.8, 2063.3999, 10.7}, {79, 1394.8, 2023.2, 10.8}, {80, 1980.6, 1622.9, 12.2} } setElementData(getTeamFromName ( "K.A.C.C" ), "spawnX", 2568.50854) setElementData(getTeamFromName ( "K.A.C.C" ), "spawnY", 2784.44873) setElementData(getTeamFromName ( "K.A.C.C" ), "spawnZ", 10.82031) setElementData(getTeamFromName ( "K.A.C.C" ), "skinas", 141 ) function spawn () if getElementType(source) ~= 'player' then return end local team = getPlayerTeam(source) if team then local x, y, z, skin = getElementData(team, "spawnX"), getElementData(team, "spawnY"), getElementData(team, "spawnZ"), getElementData(team, "skinas") spawnPlayer (source, x, y, z, 0, skin, 0, 0) giveWeapon (source, 24, 126) setWeaponAmmo (source, 24, 126) fadeCamera (source, true) setCameraTarget (source, source) else local rand = math.random(1, #spawnpoints) local spawnpoint = spawnpoints[rand] local x,y,z = spawnpoint[2], spawnpoint[3], spawnpoint[4] spawnPlayer (source, x, y, z, 0, getElementModel(source), 0, 0) outputChatBox("Player Spawned at X: "..x.." Y: ".. y.." Z: "..z) end end addEventHandler("onPlayerWasted", getRootElement(), spawn, true, "high+4")
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more