helpema 3.0.210108 → 3.0.210706
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/helpema.rb +1 -1
- data/lib/helpema/ssss.rb +32 -31
- data/lib/helpema/youtubedl.rb +18 -17
- data/lib/helpema/zbar.rb +35 -31
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 295a6ea0d195e0b52b4f0960d946e87975cbf73059c93e08c54b2aa797e4e17c
|
4
|
+
data.tar.gz: 65ee413650aaff19864215e8fe95f29f5aa0e898510b13ee436d737aacd535c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adbb195324d7f68fd7bb7033cbef3f9a925c7fe9866c834862779fdb9e306b4ecb4967aa2ad31cacad639b45a6555203c9bae7a049dadf552231b39efd43fdc1
|
7
|
+
data.tar.gz: 43d34fde681cdcbe0a2dbf4927402fd92c63eaae10d69a40894610fcea3b20c28622790829f585f22bbf9349206c62be4e344deb62bd76c72436cb55fe97759e
|
data/README.md
CHANGED
data/lib/helpema.rb
CHANGED
data/lib/helpema/ssss.rb
CHANGED
@@ -1,36 +1,37 @@
|
|
1
1
|
module Helpema
|
2
|
-
module SSSS
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
module SSSS
|
3
|
+
extend Helpema
|
4
|
+
class << self; attr_accessor :version; end
|
5
|
+
SSSS.version = 'Version: 0\.[567]\b' # version as of this writing is 0.5
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
SSSS.define_command(:_split,
|
8
|
+
cmd: 'ssss-split', v: SSSS.version,
|
9
|
+
usage: {Q:true,t:2,n:3,w:nil,s:nil,x:false},
|
10
|
+
synonyms: {threshold: :t, shares: :n, token: :w, level: :s, hexmode: :x},
|
11
|
+
mode: 'w+', exception: 'ssss-split failed.',
|
12
|
+
err: [:child, :out]
|
13
|
+
) do |pipe, options, blk|
|
14
|
+
pipe.puts options.fetch(:secret)
|
15
|
+
pipe.read.split.last(options[:shares])
|
16
|
+
end
|
17
|
+
def split(secret:, threshold:, shares:, token:nil, level:nil, hexmode:false) =
|
18
|
+
SSSS._split(secret:secret, threshold:threshold, shares:shares, token:token, level:level, hexmode:hexmode)
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
secrets
|
31
|
-
|
32
|
-
|
20
|
+
SSSS.define_command(:_combine,
|
21
|
+
cmd: 'ssss-combine', v: SSSS.version,
|
22
|
+
usage: {Q:true,t:2,x:false}, synonyms: {threshold: :t, hexmode: :x},
|
23
|
+
mode: 'w+', exception: 'ssss-combine failed.',
|
24
|
+
err: [:child, :out]
|
25
|
+
) do |pipe, options, blk|
|
26
|
+
secrets,n = options.fetch_values(:secrets,:threshold)
|
27
|
+
secrets.first(n).each{pipe.puts _1}
|
28
|
+
pipe.read.lines.last.chomp
|
29
|
+
end
|
30
|
+
def combine(secrets:, threshold:, hexmode:false)
|
31
|
+
raise 'Need threshold number of secrets.' unless secrets.size >= threshold
|
32
|
+
SSSS._combine(secrets:secrets, threshold:threshold, hexmode:hexmode)
|
33
|
+
end
|
34
|
+
|
35
|
+
extend self
|
33
36
|
end
|
34
37
|
end
|
35
|
-
end
|
36
|
-
end
|
data/lib/helpema/youtubedl.rb
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
3
|
module Helpema
|
4
|
-
module YouTubeDL
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
module YouTubeDL
|
5
|
+
extend Helpema
|
6
|
+
class << self; attr_accessor :version; end
|
7
|
+
YouTubeDL.version = '^202\d\.[01]\d\.[0123]\d$'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
YouTubeDL.define_command(:_json,
|
10
|
+
cmd: 'youtube-dl', version: YouTubeDL.version,
|
11
|
+
usage: {j:true, arg0:nil}, synonyms: {url: :arg0},
|
12
|
+
err: '/dev/null'
|
13
|
+
) do |pipe, options, blk|
|
14
|
+
pipe.each do |data|
|
15
|
+
begin
|
16
|
+
data = JSON.parse data
|
17
|
+
ensure
|
18
|
+
blk.call data
|
19
|
+
end
|
20
20
|
end
|
21
21
|
end
|
22
|
+
def json(url, &blk) = YouTubeDL._json(url:url, &blk)
|
23
|
+
|
24
|
+
extend self
|
22
25
|
end
|
23
26
|
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/helpema/zbar.rb
CHANGED
@@ -1,42 +1,46 @@
|
|
1
1
|
require 'tmpdir'
|
2
2
|
|
3
3
|
module Helpema
|
4
|
-
module ZBar
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
module ZBar
|
5
|
+
extend Helpema
|
6
|
+
class << self; attr_accessor :version, :screenshot; end
|
7
|
+
ZBar.version = '^0\.2[345]\b' # version as of this writing is 0.23
|
8
|
+
ZBar.screenshot = ['gnome-screenshot', '-f']
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
cmd: 'zbarcam', version: ZBar.version,
|
13
|
-
usage: {raw:true,quiet:true,nodisplay:true, :prescale= => '800x800'},
|
14
|
-
synonyms: {prescale: :prescale=}
|
15
|
-
) do |pipe, kw, blk|
|
16
|
-
begin
|
17
|
-
pipe.gets.chomp # This is the return value!
|
18
|
-
ensure
|
19
|
-
Process.kill('TERM', pipe.pid)
|
10
|
+
def snapshot(filename)
|
11
|
+
system(*ZBar.screenshot, filename)
|
20
12
|
end
|
21
|
-
end
|
22
13
|
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
ZBar.define_command(:_cam,
|
15
|
+
cmd: 'zbarcam',
|
16
|
+
version: ZBar.version,
|
17
|
+
usage: {raw:true,quiet:true,nodisplay:true, :prescale= => '800x800'},
|
18
|
+
synonyms: {prescale: :prescale=}
|
19
|
+
) do |pipe, kw, blk|
|
20
|
+
begin
|
21
|
+
pipe.gets.chomp # This is the return value!
|
22
|
+
ensure
|
23
|
+
Process.kill('TERM', pipe.pid)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
def cam() = ZBar._cam()
|
27
|
+
|
28
|
+
ZBar.define_command(:_img,
|
29
|
+
cmd: 'zbarimg',
|
30
|
+
version: ZBar.version,
|
31
|
+
usage: {q:true,raw:true,arg0:nil},
|
32
|
+
synonyms: {filename: :arg0})
|
33
|
+
def img(filename) = ZBar._img(filename:filename)
|
26
34
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
35
|
+
def screen
|
36
|
+
raw = nil
|
37
|
+
Dir.mktmpdir do |tmpdir|
|
38
|
+
_ = File.join(tmpdir, "#{$$}.#{Time.now.to_f}.png")
|
39
|
+
raw = _ if ZBar.snapshot(_) and not (_=ZBar.img(_).chomp).empty?
|
40
|
+
end
|
41
|
+
raw
|
32
42
|
end
|
33
|
-
raw
|
34
|
-
end
|
35
43
|
|
36
|
-
|
37
|
-
def snapshot(filename)
|
38
|
-
system(*ZBar.screenshot, filename)
|
44
|
+
extend self
|
39
45
|
end
|
40
46
|
end
|
41
|
-
end
|
42
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: helpema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.210706
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- carlosjhr64
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
Meant to be an eclectic collection of useful single functions and wrappers.
|
@@ -44,14 +44,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
requirements:
|
47
|
-
- 'ruby: ruby 3.0.
|
48
|
-
- 'youtube-dl:
|
47
|
+
- 'ruby: ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]'
|
48
|
+
- 'youtube-dl: 2021.06.06'
|
49
49
|
- 'ssss-split: 0.5'
|
50
50
|
- 'ssss-combine: 0.5'
|
51
51
|
- 'zbarcam: 0.23'
|
52
52
|
- 'zbarimg: 0.23'
|
53
|
-
- 'gnome-screenshot: gnome-screenshot
|
54
|
-
rubygems_version: 3.2.
|
53
|
+
- 'gnome-screenshot: gnome-screenshot 40.0'
|
54
|
+
rubygems_version: 3.2.15
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: Meant to be an eclectic collection of useful single functions and wrappers.
|