hed 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/hed +2 -35
- data/lib/hed/mainwnd.rb +54 -0
- data/lib/hed/runner.rb +28 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDlhM2M5ZWU5MWVhNGE1YzdlZDBmZDQ0YWJjYmFmNDg2NjAyNDVmMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjgyYTAwZTdkOTJkNmJkNTNmZDJiYTcxNzkyYzA5NDZmMjAzMzI5OA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2JkYTQzMTUyOTdkMTllYmZkNjcxYmUyMmE4OGZjMDhlNWUwMTJiMTJkODI5
|
10
|
+
YmMyNmFjYTVkZDVlZTdjZjlmNjc1Njc0YWRmZmQ2MTg2MDdjNTYyZjM4N2Ux
|
11
|
+
OTZmYjhhY2M4MjU2YTI0OWNiMDVhMmU1YWVjY2M3NDU5OGIyOTI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmQ0N2FjNDY1ZmJmMGM5ODlkZGNlNDQ1NzBhZTkyZTRlOTc1ZDRkZTA2MWY3
|
14
|
+
YTFhNzEzN2E0ODZhYjE4Yjc0YmQzMzEzYWVjODJiNzQ4YjRkYzU3OTZkN2I3
|
15
|
+
YzRjYTkxMjM3ZWE2YWE0NzMzMWFhM2NhYjVlNzRjMDgxNDg0YzQ=
|
data/bin/hed
CHANGED
@@ -1,42 +1,9 @@
|
|
1
1
|
#!/usr/bin/ruby19
|
2
2
|
# encoding: UTF-8
|
3
3
|
|
4
|
-
require '
|
4
|
+
require 'hed/runner'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
Curses.init_screen
|
9
|
-
|
10
|
-
win = Curses::Window.new Curses.lines, Curses.cols, 0, 0
|
11
|
-
|
12
|
-
addrwin = win.subwin Curses.lines, 8, 0, 0
|
13
|
-
binwin = win.subwin Curses.lines, 16*3+1, 0, 8+2
|
14
|
-
textwin = win.subwin Curses.lines, 16, 0, 8+2 + 16*3+1+2
|
15
|
-
|
16
|
-
Curses.lines.times do |y|
|
17
|
-
addrwin.setpos y, 0
|
18
|
-
addrwin << "%08x" % y*16
|
19
|
-
end
|
20
|
-
|
21
|
-
Curses.lines.times do |y|
|
22
|
-
binwin.setpos y, 0
|
23
|
-
|
24
|
-
16.times do |x|
|
25
|
-
binwin << "%02x " % buf[y*16+x].unpack("C")[0]
|
26
|
-
binwin << ' ' if x == 16/2 - 1
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
Curses.lines.times do |y|
|
31
|
-
textwin.setpos y, 0
|
32
|
-
textwin << buf[y*16..(y+1)*16].gsub(/[^[:print:]]/, '⌘')
|
33
|
-
end
|
34
|
-
|
35
|
-
win.setpos 0, 10
|
36
|
-
|
37
|
-
win.refresh
|
38
|
-
|
39
|
-
sleep 10
|
6
|
+
Hed::Runner.run
|
40
7
|
|
41
8
|
# vim: sw=2 sts=2 ts=8:
|
42
9
|
|
data/lib/hed/mainwnd.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#!/usr/bin/ruby19
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require 'curses'
|
5
|
+
|
6
|
+
|
7
|
+
module Hed
|
8
|
+
|
9
|
+
class MainWnd
|
10
|
+
@buf
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@win = Curses::Window.new Curses.lines, Curses.cols, 0, 0
|
14
|
+
|
15
|
+
@addrwin = @win.subwin Curses.lines, 8, 0, 0
|
16
|
+
@binwin = @win.subwin Curses.lines, 16*3+1, 0, 8+2
|
17
|
+
@textwin = @win.subwin Curses.lines, 16, 0, 8+2 + 16*3+1+2
|
18
|
+
|
19
|
+
@win.setpos 0, 10
|
20
|
+
end
|
21
|
+
|
22
|
+
def buffer= buf
|
23
|
+
@buf = buf
|
24
|
+
end
|
25
|
+
|
26
|
+
def refresh
|
27
|
+
Curses.lines.times do |y|
|
28
|
+
@addrwin.setpos y, 0
|
29
|
+
@addrwin << '%08xd' % [y*16]
|
30
|
+
end
|
31
|
+
|
32
|
+
Curses.lines.times do |y|
|
33
|
+
@binwin.setpos y, 0
|
34
|
+
|
35
|
+
16.times do |x|
|
36
|
+
@binwin << '%02x ' % @buf[y*16+x].unpack('C')
|
37
|
+
@binwin << ' ' if x == 16/2 - 1
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
Curses.lines.times do |y|
|
42
|
+
@textwin.setpos y, 0
|
43
|
+
@textwin << @buf[y*16..(y+1)*16].gsub(/[^[:print:]]/, '⌘')
|
44
|
+
end
|
45
|
+
|
46
|
+
@win.refresh
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
# vim: sw=2 sts=2 ts=8:
|
54
|
+
|
data/lib/hed/runner.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/ruby19
|
2
|
+
# encoding: UTF-8
|
3
|
+
|
4
|
+
require 'curses'
|
5
|
+
|
6
|
+
require 'hed/mainwnd'
|
7
|
+
|
8
|
+
|
9
|
+
module Hed
|
10
|
+
|
11
|
+
class Runner
|
12
|
+
def self.run
|
13
|
+
Curses.init_screen
|
14
|
+
|
15
|
+
wnd = Hed::MainWnd.new
|
16
|
+
|
17
|
+
wnd.buffer = IO.binread '/etc/fstab'
|
18
|
+
|
19
|
+
wnd.refresh
|
20
|
+
|
21
|
+
sleep 10
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
# vim: sw=2 sts=2 ts=8:
|
28
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Levenkov Artem
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Vim-like hex editor
|
14
14
|
email: artem@levenkov.org
|
@@ -17,6 +17,8 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- lib/hed/runner.rb
|
21
|
+
- lib/hed/mainwnd.rb
|
20
22
|
- bin/hed
|
21
23
|
homepage: http://www.unixcmd.org/
|
22
24
|
licenses:
|