diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-03-14 01:55:33 +0100 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2010-03-14 01:55:33 +0100 |
commit | 237470c8f45190b213e3a173ce6ae1a74b3e11fe (patch) | |
tree | 7f53c8144761947d4bde20715bcad34f4be0d6c0 /entropy.lua | |
parent | 9a82d4113a8271b7dfc7506f2b07379e3ede89a8 (diff) | |
download | vicious-legacy-237470c8f45190b213e3a173ce6ae1a74b3e11fe.tar.xz |
API: transform widgets namespace table to a directory
Diffstat (limited to 'entropy.lua')
-rw-r--r-- | entropy.lua | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/entropy.lua b/entropy.lua deleted file mode 100644 index 8ca0c30..0000000 --- a/entropy.lua +++ /dev/null @@ -1,33 +0,0 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. <anrxc@sysphere.org> ---------------------------------------------------- - --- {{{ Grab environment -local tonumber = tonumber -local setmetatable = setmetatable -local math = { ceil = math.ceil } -local helpers = require("vicious.helpers") --- }}} - - --- Entropy: provides available system entropy -module("vicious.entropy") - - --- {{{ Entropy widget type -local function worker(format) - local random = helpers.pathtotable("/proc/sys/kernel/random") - - -- Linux 2.6 has a default entropy pool of 4096-bits - local poolsize = tonumber(random.poolsize) - -- Get available entropy - local ent = tonumber(random.entropy_avail) - -- Calculate percentage - local ent_percent = math.ceil(ent * 100 / poolsize) - - return {ent, ent_percent} -end --- }}} - -setmetatable(_M, { __call = function(_, ...) return worker(...) end }) |