utils 0.21.2 → 0.23.3
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/Rakefile +2 -1
- data/VERSION +1 -1
- data/bin/discover +15 -7
- data/bin/fix-brew +5 -0
- data/bin/irb_connect +3 -4
- data/bin/path +1 -1
- data/lib/utils.rb +0 -1
- data/lib/utils/editor.rb +1 -1
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +8 -6
- metadata +21 -31
- data/bin/brakeman2err +0 -33
- data/bin/chroot-exec +0 -15
- data/bin/chroot-libs +0 -26
- data/bin/dialog-pick +0 -11
- data/bin/errf +0 -32
- data/bin/remote_copy +0 -13
- data/bin/rssr +0 -37
- data/bin/same_files +0 -38
- data/bin/tmproc +0 -21
- data/bin/unquarantine_apps +0 -13
- data/bin/vacuum_firefox_sqlite +0 -23
- data/bin/xmp +0 -74
- data/lib/utils/search_ui.rb +0 -75
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c95464b253cb85d05617e4b275203b3689541c1aa00fbf901dc95e4bc8791ad
|
|
4
|
+
data.tar.gz: 2d93548e2fef0a840b241b842709068a4ab6608a3154d9dd0575ce18bede0aaa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ad69474f1ddbfe88f5fdf5ab59368ddbd5ded197520994cbfe60d580d6a4ebc2c37a4c13ab8b7018011bd0276d0cc54a4b23762953f29efbb4d814aa3eb0812
|
|
7
|
+
data.tar.gz: 732bc43a8d327d14a85f349e378984375c1c4c6027828daf1767a504c8e35169efbc793f38857c21989dc9776c6dcb32fe4d30f4d6f4875052b1178b97e6a0d8
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.23.3
|
data/bin/discover
CHANGED
|
@@ -4,6 +4,8 @@ require 'utils'
|
|
|
4
4
|
include Utils
|
|
5
5
|
require 'tins/xt'
|
|
6
6
|
include Tins::GO
|
|
7
|
+
require 'search_ui'
|
|
8
|
+
include SearchUI
|
|
7
9
|
|
|
8
10
|
def edit_files(*paths, pick: false, wait: true)
|
|
9
11
|
editor = Utils::Editor.new
|
|
@@ -83,22 +85,28 @@ when args[?s]
|
|
|
83
85
|
pattern = pattern.dup
|
|
84
86
|
args[?n] = Term::ANSIColor.terminal_lines - 1
|
|
85
87
|
path = nil
|
|
86
|
-
found =
|
|
87
|
-
|
|
88
|
+
found = Search.new(
|
|
89
|
+
match: -> answer {
|
|
88
90
|
pattern.replace answer
|
|
89
91
|
f = finder.()
|
|
90
|
-
f.search.output
|
|
92
|
+
matches = f.search.output
|
|
93
|
+
matches.first(Tins::Terminal.lines - 1)
|
|
91
94
|
},
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
query: -> _answer, matches, selector {
|
|
96
|
+
matches.each_with_index.map { |l, i| (i == selector ? '> ' : ' ') + l }.join(?\n)
|
|
97
|
+
},
|
|
98
|
+
found: -> _answer, matches, selector {
|
|
99
|
+
if f
|
|
100
|
+
path = f.paths[selector]
|
|
101
|
+
end
|
|
94
102
|
},
|
|
95
103
|
output: STDERR
|
|
96
104
|
).start
|
|
97
105
|
if found
|
|
98
106
|
if args[?e]
|
|
99
|
-
edit_files
|
|
107
|
+
edit_files found, wait: false
|
|
100
108
|
else
|
|
101
|
-
found and puts
|
|
109
|
+
found and puts found
|
|
102
110
|
end
|
|
103
111
|
exit 0
|
|
104
112
|
else
|
data/bin/fix-brew
ADDED
data/bin/irb_connect
CHANGED
|
@@ -14,8 +14,7 @@ Options are
|
|
|
14
14
|
|
|
15
15
|
-e CODE CODE is execute on the remote irb
|
|
16
16
|
-l PATH load file PATH into remote irb context
|
|
17
|
-
-
|
|
18
|
-
-p PORTNUMBER number of the remote port (defaults to #{Utils::IRB::Service.port})
|
|
17
|
+
-u URL druby url to connect to
|
|
19
18
|
-h display this help
|
|
20
19
|
|
|
21
20
|
Version is #{File.basename($0)} #{Utils::VERSION}.
|
|
@@ -24,10 +23,10 @@ Version is #{File.basename($0)} #{Utils::VERSION}.
|
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
|
|
27
|
-
$opts = go 'e:
|
|
26
|
+
$opts = go 'e:u:l:h'
|
|
28
27
|
$opts[?h] and usage
|
|
29
28
|
|
|
30
|
-
proxy = Utils::IRB::Service.connect($opts[?
|
|
29
|
+
proxy = Utils::IRB::Service.connect($opts[?u])
|
|
31
30
|
case
|
|
32
31
|
when load_path = $opts[?l]
|
|
33
32
|
proxy.load(load_path)
|
data/bin/path
CHANGED
data/lib/utils.rb
CHANGED
data/lib/utils/editor.rb
CHANGED
data/lib/utils/version.rb
CHANGED
data/utils.gemspec
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: utils 0.
|
|
2
|
+
# stub: utils 0.23.3 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "utils".freeze
|
|
6
|
-
s.version = "0.
|
|
6
|
+
s.version = "0.23.3"
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
|
10
10
|
s.authors = ["Florian Frank".freeze]
|
|
11
|
-
s.date = "2020-
|
|
11
|
+
s.date = "2020-10-03"
|
|
12
12
|
s.description = "This ruby gem provides some useful command line utilities".freeze
|
|
13
13
|
s.email = "flori@ping.de".freeze
|
|
14
|
-
s.executables = ["discover".freeze, "classify".freeze, "sedit".freeze, "irb_connect".freeze, "ascii7".freeze, "path".freeze, "enum".freeze, "
|
|
15
|
-
s.extra_rdoc_files = ["README.md".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/
|
|
16
|
-
s.files = [".gitignore".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/
|
|
14
|
+
s.executables = ["discover".freeze, "classify".freeze, "sedit".freeze, "irb_connect".freeze, "ascii7".freeze, "path".freeze, "enum".freeze, "ssh-tunnel".freeze, "search".freeze, "edit".freeze, "json_check".freeze, "edit_wait".freeze, "untest".freeze, "blameline".freeze, "git-empty".freeze, "create_cstags".freeze, "git-versions".freeze, "strip_spaces".freeze, "fix-brew".freeze, "number_files".freeze, "serve".freeze, "vcf2alias".freeze, "on_change".freeze, "utils-utilsrc".freeze, "myex".freeze, "long_lines".freeze, "probe".freeze, "create_tags".freeze]
|
|
15
|
+
s.extra_rdoc_files = ["README.md".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze]
|
|
16
|
+
s.files = [".gitignore".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/classify".freeze, "bin/create_cstags".freeze, "bin/create_tags".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/fix-brew".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_connect".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/number_files".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/probe".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vcf2alias".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/service.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "utils.gemspec".freeze]
|
|
17
17
|
s.homepage = "http://github.com/flori/utils".freeze
|
|
18
18
|
s.rdoc_options = ["--title".freeze, "Utils - Some useful command line utilities".freeze, "--main".freeze, "README.md".freeze]
|
|
19
19
|
s.rubygems_version = "3.1.2".freeze
|
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
|
30
30
|
s.add_runtime_dependency(%q<pstree>.freeze, ["~> 0.3"])
|
|
31
31
|
s.add_runtime_dependency(%q<infobar>.freeze, [">= 0"])
|
|
32
32
|
s.add_runtime_dependency(%q<mize>.freeze, [">= 0"])
|
|
33
|
+
s.add_runtime_dependency(%q<search_ui>.freeze, [">= 0"])
|
|
33
34
|
else
|
|
34
35
|
s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
|
|
35
36
|
s.add_dependency(%q<tins>.freeze, ["~> 1.14"])
|
|
@@ -37,5 +38,6 @@ Gem::Specification.new do |s|
|
|
|
37
38
|
s.add_dependency(%q<pstree>.freeze, ["~> 0.3"])
|
|
38
39
|
s.add_dependency(%q<infobar>.freeze, [">= 0"])
|
|
39
40
|
s.add_dependency(%q<mize>.freeze, [">= 0"])
|
|
41
|
+
s.add_dependency(%q<search_ui>.freeze, [">= 0"])
|
|
40
42
|
end
|
|
41
43
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.23.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-10-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gem_hadar
|
|
@@ -94,6 +94,20 @@ dependencies:
|
|
|
94
94
|
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: search_ui
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
97
111
|
description: This ruby gem provides some useful command line utilities
|
|
98
112
|
email: flori@ping.de
|
|
99
113
|
executables:
|
|
@@ -104,36 +118,25 @@ executables:
|
|
|
104
118
|
- ascii7
|
|
105
119
|
- path
|
|
106
120
|
- enum
|
|
107
|
-
- unquarantine_apps
|
|
108
121
|
- ssh-tunnel
|
|
109
|
-
- xmp
|
|
110
|
-
- brakeman2err
|
|
111
122
|
- search
|
|
112
|
-
- chroot-exec
|
|
113
123
|
- edit
|
|
114
|
-
- tmproc
|
|
115
124
|
- json_check
|
|
116
125
|
- edit_wait
|
|
117
|
-
- errf
|
|
118
126
|
- untest
|
|
119
127
|
- blameline
|
|
120
|
-
- remote_copy
|
|
121
128
|
- git-empty
|
|
122
129
|
- create_cstags
|
|
123
|
-
- vacuum_firefox_sqlite
|
|
124
|
-
- same_files
|
|
125
|
-
- chroot-libs
|
|
126
130
|
- git-versions
|
|
127
131
|
- strip_spaces
|
|
132
|
+
- fix-brew
|
|
128
133
|
- number_files
|
|
129
|
-
- rssr
|
|
130
134
|
- serve
|
|
131
135
|
- vcf2alias
|
|
132
136
|
- on_change
|
|
133
137
|
- utils-utilsrc
|
|
134
138
|
- myex
|
|
135
139
|
- long_lines
|
|
136
|
-
- dialog-pick
|
|
137
140
|
- probe
|
|
138
141
|
- create_tags
|
|
139
142
|
extensions: []
|
|
@@ -152,7 +155,6 @@ extra_rdoc_files:
|
|
|
152
155
|
- lib/utils/md5.rb
|
|
153
156
|
- lib/utils/patterns.rb
|
|
154
157
|
- lib/utils/probe_server.rb
|
|
155
|
-
- lib/utils/search_ui.rb
|
|
156
158
|
- lib/utils/ssh_tunnel_specification.rb
|
|
157
159
|
- lib/utils/version.rb
|
|
158
160
|
- lib/utils/xt/source_location_extension.rb
|
|
@@ -165,18 +167,14 @@ files:
|
|
|
165
167
|
- VERSION
|
|
166
168
|
- bin/ascii7
|
|
167
169
|
- bin/blameline
|
|
168
|
-
- bin/brakeman2err
|
|
169
|
-
- bin/chroot-exec
|
|
170
|
-
- bin/chroot-libs
|
|
171
170
|
- bin/classify
|
|
172
171
|
- bin/create_cstags
|
|
173
172
|
- bin/create_tags
|
|
174
|
-
- bin/dialog-pick
|
|
175
173
|
- bin/discover
|
|
176
174
|
- bin/edit
|
|
177
175
|
- bin/edit_wait
|
|
178
176
|
- bin/enum
|
|
179
|
-
- bin/
|
|
177
|
+
- bin/fix-brew
|
|
180
178
|
- bin/git-empty
|
|
181
179
|
- bin/git-versions
|
|
182
180
|
- bin/irb_connect
|
|
@@ -187,21 +185,14 @@ files:
|
|
|
187
185
|
- bin/on_change
|
|
188
186
|
- bin/path
|
|
189
187
|
- bin/probe
|
|
190
|
-
- bin/remote_copy
|
|
191
|
-
- bin/rssr
|
|
192
|
-
- bin/same_files
|
|
193
188
|
- bin/search
|
|
194
189
|
- bin/sedit
|
|
195
190
|
- bin/serve
|
|
196
191
|
- bin/ssh-tunnel
|
|
197
192
|
- bin/strip_spaces
|
|
198
|
-
- bin/tmproc
|
|
199
|
-
- bin/unquarantine_apps
|
|
200
193
|
- bin/untest
|
|
201
194
|
- bin/utils-utilsrc
|
|
202
|
-
- bin/vacuum_firefox_sqlite
|
|
203
195
|
- bin/vcf2alias
|
|
204
|
-
- bin/xmp
|
|
205
196
|
- lib/utils.rb
|
|
206
197
|
- lib/utils/config_file.rb
|
|
207
198
|
- lib/utils/editor.rb
|
|
@@ -215,7 +206,6 @@ files:
|
|
|
215
206
|
- lib/utils/md5.rb
|
|
216
207
|
- lib/utils/patterns.rb
|
|
217
208
|
- lib/utils/probe_server.rb
|
|
218
|
-
- lib/utils/search_ui.rb
|
|
219
209
|
- lib/utils/ssh_tunnel_specification.rb
|
|
220
210
|
- lib/utils/version.rb
|
|
221
211
|
- lib/utils/xt/source_location_extension.rb
|
|
@@ -223,7 +213,7 @@ files:
|
|
|
223
213
|
homepage: http://github.com/flori/utils
|
|
224
214
|
licenses: []
|
|
225
215
|
metadata: {}
|
|
226
|
-
post_install_message:
|
|
216
|
+
post_install_message:
|
|
227
217
|
rdoc_options:
|
|
228
218
|
- "--title"
|
|
229
219
|
- Utils - Some useful command line utilities
|
|
@@ -243,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
243
233
|
version: '0'
|
|
244
234
|
requirements: []
|
|
245
235
|
rubygems_version: 3.1.2
|
|
246
|
-
signing_key:
|
|
236
|
+
signing_key:
|
|
247
237
|
specification_version: 4
|
|
248
238
|
summary: Some useful command line utilities
|
|
249
239
|
test_files: []
|
data/bin/brakeman2err
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'utils'
|
|
4
|
-
require 'json'
|
|
5
|
-
require 'tins/xt'
|
|
6
|
-
require 'tins/go'
|
|
7
|
-
include Tins::GO
|
|
8
|
-
require 'infobar'
|
|
9
|
-
|
|
10
|
-
opts = go 'ce'
|
|
11
|
-
if opts[?c]
|
|
12
|
-
brakeman = `bundle exec which brakeman`.full? or fail "cannot find brakeman in path"
|
|
13
|
-
Infobar.busy(label: 'Computing brakeman results') do
|
|
14
|
-
system 'bundle exec brakeman -q -i config/brakeman.yml -o .brakeman.json 2>/dev/null' or fail "calling brakeman failed"
|
|
15
|
-
end
|
|
16
|
-
else
|
|
17
|
-
results = JSON File.read('.brakeman.json'), object_class: JSON::GenericObject
|
|
18
|
-
if opts[?e]
|
|
19
|
-
puts "Found #{results.errors.size} errors and #{results.warnings.size} warnings.",
|
|
20
|
-
"_" * 80
|
|
21
|
-
for error in results.errors
|
|
22
|
-
puts error.location, "Error #{error.error.inspect}"
|
|
23
|
-
end
|
|
24
|
-
else
|
|
25
|
-
puts "Found #{results.warnings.size} warnings.", "_" * 80
|
|
26
|
-
end
|
|
27
|
-
for warning in results.warnings
|
|
28
|
-
puts "#{warning.file}:#{warning.line}",
|
|
29
|
-
"#{warning.warning_type} (#{warning.confidence}) #{warning.message.inspect}",
|
|
30
|
-
warning.code, "See: #{warning.link}"
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
end
|
data/bin/chroot-exec
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'fileutils'
|
|
4
|
-
include FileUtils
|
|
5
|
-
|
|
6
|
-
dir = ARGV.shift or fail 'require directory to chroot into'
|
|
7
|
-
prg = ARGV.shift || '/bin/bash'
|
|
8
|
-
system "mount -t proc none #{dir}/proc"
|
|
9
|
-
system "mount -o bind /dev #{dir}/dev"
|
|
10
|
-
File.exist?(resolv = "#{dir}/etc/resolv.conf") and
|
|
11
|
-
cp resolv, resolv + '.bak'
|
|
12
|
-
cp '/etc/resolv.conf', resolv
|
|
13
|
-
system "chroot #{dir} #{prg}"
|
|
14
|
-
system "umount #{dir}/proc"
|
|
15
|
-
system "umount #{dir}/dev"
|
data/bin/chroot-libs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'fileutils'
|
|
4
|
-
include FileUtils::Verbose
|
|
5
|
-
|
|
6
|
-
msg = "Usage: #$0 EXECUTABLE DIR [LIB ..]"
|
|
7
|
-
executable = ARGV.shift or fail msg
|
|
8
|
-
dir = ARGV.shift or fail msg
|
|
9
|
-
dir = File.expand_path dir
|
|
10
|
-
mkdir_p dir
|
|
11
|
-
|
|
12
|
-
unless executable.start_with? '/'
|
|
13
|
-
executable = `which #{executable}`.chomp
|
|
14
|
-
end
|
|
15
|
-
libs = `ldd #{executable}`.gsub(/^(?:.*?\s+=>\s+|\s+)(.*?)\(.*/, '\1').lines.grep(/\S/).map { |x| x.strip }
|
|
16
|
-
libs.concat ARGV
|
|
17
|
-
cd dir do
|
|
18
|
-
cp executable, File.basename(executable)
|
|
19
|
-
for l in libs
|
|
20
|
-
begin
|
|
21
|
-
cp l, File.basename(l)
|
|
22
|
-
rescue Errno::ENOENT => e
|
|
23
|
-
warn "Caught #{e.class}: #{e}"
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
data/bin/dialog-pick
DELETED
data/bin/errf
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'term/ansicolor'
|
|
4
|
-
|
|
5
|
-
class String
|
|
6
|
-
include Term::ANSIColor
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
file = ARGV.shift
|
|
10
|
-
name = ARGV.shift
|
|
11
|
-
ENV['RUBYOPT'] = "#{ENV['RUBYOPT']} -Iext:lib:test:tests"
|
|
12
|
-
|
|
13
|
-
STDOUT.sync = true
|
|
14
|
-
begin
|
|
15
|
-
output =
|
|
16
|
-
if name
|
|
17
|
-
IO.popen("testrb -p '' -n #{name} #{file}", 'r')
|
|
18
|
-
else
|
|
19
|
-
IO.popen("testrb -p '' #{file}", 'r')
|
|
20
|
-
end
|
|
21
|
-
until output.eof?
|
|
22
|
-
line = output.readline.uncolored
|
|
23
|
-
new_line = line.chomp
|
|
24
|
-
if new_line.sub!(%r(^(?:\s|[\/\[])*([^:]+):(\d+):(.*))) { "#$1:#$2:#$3" }
|
|
25
|
-
puts new_line
|
|
26
|
-
else
|
|
27
|
-
puts line
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
ensure
|
|
31
|
-
output and output.close
|
|
32
|
-
end
|
data/bin/remote_copy
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'socket'
|
|
4
|
-
|
|
5
|
-
copy_remote_host_port = ENV['COPY_REMOTE_HOST_PORT'] and
|
|
6
|
-
copy_remote_host_port =~ /\A([^:]+):([^:]+)\z/ or
|
|
7
|
-
fail "environment variable COPY_REMOTE_HOST_PORT of form host:port required"
|
|
8
|
-
copy_remote_host, copy_remote_port = $1, $2
|
|
9
|
-
|
|
10
|
-
clipboard = TCPSocket.new(copy_remote_host, copy_remote_port)
|
|
11
|
-
until STDIN.eof?
|
|
12
|
-
clipboard.write STDIN.read(1 << 16)
|
|
13
|
-
end
|
data/bin/rssr
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'rss'
|
|
4
|
-
require 'tins'
|
|
5
|
-
require 'open-uri'
|
|
6
|
-
require 'term/ansicolor'
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class String
|
|
10
|
-
include Term::ANSIColor
|
|
11
|
-
|
|
12
|
-
def wrap(cols: Tins::Terminal.cols)
|
|
13
|
-
split(?\n).each do |line|
|
|
14
|
-
line.size > cols and line.gsub!(/(.{1,#{cols}})(\s+|$)/, "\\1\n")
|
|
15
|
-
line.strip!
|
|
16
|
-
end * ?\n
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
IO.popen(ENV.fetch('PAGER', `which less`.chomp << ' -r'), 'w') do |pager|
|
|
21
|
-
url = ARGV.shift
|
|
22
|
-
open(url) do |rss|
|
|
23
|
-
feed = RSS::Parser.parse(rss)
|
|
24
|
-
pager.puts "Feed: #{feed.channel.title}",
|
|
25
|
-
?– * Tins::Terminal.cols
|
|
26
|
-
feed.items.sort_by { |item| -item.date.to_f }.each do |item|
|
|
27
|
-
pager.puts(
|
|
28
|
-
"Title: #{item.title.bright_blue}",
|
|
29
|
-
"Link: #{item.link.red}",
|
|
30
|
-
"Date: #{item.date.strftime('%FT%T%z')}",
|
|
31
|
-
"",
|
|
32
|
-
item.description.wrap.chomp.white,
|
|
33
|
-
?– * Tins::Terminal.cols
|
|
34
|
-
)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
data/bin/same_files
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'utils'
|
|
4
|
-
require 'tins/find'
|
|
5
|
-
include Utils::MD5
|
|
6
|
-
|
|
7
|
-
def find_same(*paths)
|
|
8
|
-
files = Hash.new { |h,k| h[k] = {} }
|
|
9
|
-
Tins::Find.find(*paths) do |filename|
|
|
10
|
-
file_stat = File.stat(filename)
|
|
11
|
-
if file_stat.file?
|
|
12
|
-
size = file_stat.size
|
|
13
|
-
$DEBUG and warn "Encountered '#{filename}' (#{size} bytes)."
|
|
14
|
-
files[size][filename] = true
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
files = files.inject({}) do |h, (_,fs)|
|
|
19
|
-
keys = fs.keys
|
|
20
|
-
if keys.size >= 2
|
|
21
|
-
keys.each { |k| h[k] = true }
|
|
22
|
-
end
|
|
23
|
-
h
|
|
24
|
-
end.keys
|
|
25
|
-
|
|
26
|
-
md5s = Hash.new { |h,k| h[k] = [] }
|
|
27
|
-
for filename in files
|
|
28
|
-
md5sum = md5 filename
|
|
29
|
-
md5s[md5sum] << filename
|
|
30
|
-
end
|
|
31
|
-
files = md5s.values
|
|
32
|
-
files.reject! { |fs| fs.size < 2 }
|
|
33
|
-
files
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
puts find_same(*ARGV).map { |fs| [ fs.size, fs ] }.sort.map { |c, fs|
|
|
37
|
-
"#{c}\t#{fs.sort.map { |f| "'#{f}'" } * "\t"}"
|
|
38
|
-
}
|
data/bin/tmproc
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'yaml'
|
|
4
|
-
require 'tins'
|
|
5
|
-
|
|
6
|
-
filename = ARGV.shift || 'Procfile'
|
|
7
|
-
procfile = YAML.load_file(filename)
|
|
8
|
-
|
|
9
|
-
unless ENV['TMUX']
|
|
10
|
-
name = File.basename(Dir.pwd)
|
|
11
|
-
exec 'tmux', 'new-session', '-s', name, '-n', ?s, '-A', $0, filename
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
tmux_pane = ENV.fetch('TMUX_PANE')
|
|
15
|
-
lines = Tins::Terminal.lines
|
|
16
|
-
|
|
17
|
-
procfile.each_value do |process|
|
|
18
|
-
system "(tmux select-pane -t #{tmux_pane} \\; split-window -l #{lines / procfile.size} #{process}) &"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
exec 'tmux', 'new-window', '-n', 'e', 'edit', ?;, 'split-window', '-h', 'bundle', 'exec', 'probe', '-l'
|
data/bin/unquarantine_apps
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'fileutils'
|
|
4
|
-
include FileUtils::Verbose
|
|
5
|
-
|
|
6
|
-
prefix = ARGV.shift || ''
|
|
7
|
-
directory = File.join(prefix, 'Applications')
|
|
8
|
-
if File.directory?(directory)
|
|
9
|
-
cd directory do
|
|
10
|
-
STDERR.puts 'xattr -rd com.apple.quarantine'
|
|
11
|
-
system 'xattr -rd com.apple.quarantine'
|
|
12
|
-
end
|
|
13
|
-
end
|
data/bin/vacuum_firefox_sqlite
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require 'fileutils'
|
|
4
|
-
include FileUtils
|
|
5
|
-
|
|
6
|
-
case `uname -s`.chomp
|
|
7
|
-
when 'Darwin'
|
|
8
|
-
profiles="#{ENV['HOME']}/Library/Application Support/Firefox/Profiles"
|
|
9
|
-
else
|
|
10
|
-
profiles="#{ENV['HOME']}/.mozilla/firefox"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
cd profiles do
|
|
14
|
-
for p in Dir['*.default']
|
|
15
|
-
cd p do
|
|
16
|
-
for db in Dir['*.sqlite']
|
|
17
|
-
print "Vacuuming #{db}..."
|
|
18
|
-
system "sqlite3 #{db} VACUUM"
|
|
19
|
-
puts "done."
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
data/bin/xmp
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
require 'open3'
|
|
3
|
-
|
|
4
|
-
class String
|
|
5
|
-
unless method_defined?(:lines)
|
|
6
|
-
def lines
|
|
7
|
-
self
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
MARKER = "!XMP#{Time.new.to_i}_#{rand(1000000)}!"
|
|
13
|
-
XMPRE = Regexp.new("^" + Regexp.escape(MARKER) + '\[([0-9]+)\] => (.*)')
|
|
14
|
-
VAR = "_xmp_#{Time.new.to_i}_#{rand(1000000)}"
|
|
15
|
-
WARNING_RE = /-:([0-9]+): warning: (.*)/
|
|
16
|
-
interpreter = ARGV
|
|
17
|
-
interpreter << 'ruby' << '-w' if interpreter.empty?
|
|
18
|
-
|
|
19
|
-
IO.popen(interpreter.first, 'w') do |script|
|
|
20
|
-
script.write <<-TEST
|
|
21
|
-
begin
|
|
22
|
-
require 'rubygems'
|
|
23
|
-
rescue LoadError
|
|
24
|
-
exit 1
|
|
25
|
-
end
|
|
26
|
-
exit 0
|
|
27
|
-
TEST
|
|
28
|
-
end
|
|
29
|
-
if $?.exitstatus == 1
|
|
30
|
-
ENV['RUBYOPT'] = ENV['RUBYOPT'].gsub(/-rr?ubygems/i, '')
|
|
31
|
-
end
|
|
32
|
-
code = STDIN.read
|
|
33
|
-
|
|
34
|
-
idx = 0
|
|
35
|
-
newcode = code.gsub(/^(.*) # =>.*/) do |l|
|
|
36
|
-
expr = $1
|
|
37
|
-
(/^\s*#/ =~ l) ? l :
|
|
38
|
-
%!((#{VAR} = (#{expr}); $stderr.puts("#{MARKER}[#{idx+=1}] => " + #{VAR}.inspect) || #{VAR}))!
|
|
39
|
-
end
|
|
40
|
-
stdin, stdout, stderr = Open3::popen3(*interpreter)
|
|
41
|
-
stdin.puts newcode
|
|
42
|
-
stdin.close
|
|
43
|
-
output = stderr.readlines
|
|
44
|
-
|
|
45
|
-
results = Hash.new{|h,k| h[k] = []}
|
|
46
|
-
output.grep(XMPRE).each do |line|
|
|
47
|
-
result_id, result = XMPRE.match(line).captures
|
|
48
|
-
results[result_id.to_i] << result
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
idx = 0
|
|
52
|
-
annotated = code.gsub(/^(.*) # =>.*/) do |l|
|
|
53
|
-
expr = $1
|
|
54
|
-
(/^\s*#/ =~ l) ? l : "#{expr} # => " + (results[idx+=1] || []).join(", ")
|
|
55
|
-
end.gsub(/ # !>.*/, '').gsub(/# (>>|~>)[^\n]*\n/m, "");
|
|
56
|
-
|
|
57
|
-
warnings = {}
|
|
58
|
-
output.join.lines.grep(WARNING_RE).map do |x|
|
|
59
|
-
md = WARNING_RE.match(x)
|
|
60
|
-
warnings[md[1].to_i] = md[2]
|
|
61
|
-
end
|
|
62
|
-
idx = 0
|
|
63
|
-
annotated = annotated.lines.map do |line|
|
|
64
|
-
w = warnings[idx+=1]
|
|
65
|
-
w ? (line.chomp + " # !> #{w}") : line
|
|
66
|
-
end
|
|
67
|
-
puts annotated
|
|
68
|
-
output.reject!{|x| /^-:[0-9]+: warning/.match(x)}
|
|
69
|
-
if exception = /^-:[0-9]+:.*/m.match(output.join)
|
|
70
|
-
puts exception[0].map{|line| "# ~> " + line }
|
|
71
|
-
end
|
|
72
|
-
if (s = stdout.read) != ""
|
|
73
|
-
puts "# >> #{s.inspect}"
|
|
74
|
-
end
|
data/lib/utils/search_ui.rb
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
require 'term/ansicolor'
|
|
2
|
-
|
|
3
|
-
class Utils::SearchUI
|
|
4
|
-
include Term::ANSIColor
|
|
5
|
-
|
|
6
|
-
def initialize(query:, found:, output: STDOUT, prompt: 'Search? %s')
|
|
7
|
-
@selector = 0
|
|
8
|
-
@query = query
|
|
9
|
-
@found = found
|
|
10
|
-
@output = output
|
|
11
|
-
@prompt = prompt
|
|
12
|
-
@answer = ''
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def start
|
|
16
|
-
@output.print clear_screen, move_home, reset
|
|
17
|
-
loop do
|
|
18
|
-
@output.print move_home { @prompt % @answer }
|
|
19
|
-
case getc
|
|
20
|
-
when true
|
|
21
|
-
@output.print clear_screen, move_home, reset
|
|
22
|
-
if result = @found.(@answer, @selector)
|
|
23
|
-
return result
|
|
24
|
-
else
|
|
25
|
-
return nil
|
|
26
|
-
end
|
|
27
|
-
when false
|
|
28
|
-
return nil
|
|
29
|
-
end
|
|
30
|
-
result = @query.(@answer, @selector)
|
|
31
|
-
@output.print clear_screen
|
|
32
|
-
unless @answer.empty?
|
|
33
|
-
@output.print move_home { ?\n + result }
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
def getc
|
|
41
|
-
system 'stty raw -echo'
|
|
42
|
-
c = STDIN.getc
|
|
43
|
-
system 'stty cooked echo'
|
|
44
|
-
case c
|
|
45
|
-
when "\x03"
|
|
46
|
-
false
|
|
47
|
-
when "\e"
|
|
48
|
-
STDIN.getc == ?[ or return nil
|
|
49
|
-
STDIN.getc =~ /\A([AB])\z/ or return nil
|
|
50
|
-
if $1 == ?A
|
|
51
|
-
@selector -= 1
|
|
52
|
-
else
|
|
53
|
-
@selector += 1
|
|
54
|
-
end
|
|
55
|
-
@selector = [ @selector, 0 ].max
|
|
56
|
-
nil
|
|
57
|
-
when ?\r
|
|
58
|
-
true
|
|
59
|
-
when "\x7f"
|
|
60
|
-
@selector = 0
|
|
61
|
-
@answer.chop!
|
|
62
|
-
nil
|
|
63
|
-
when "\v"
|
|
64
|
-
@selector = 0
|
|
65
|
-
@answer.clear
|
|
66
|
-
nil
|
|
67
|
-
when /\A[\x00-\x1f]\z/
|
|
68
|
-
nil
|
|
69
|
-
else
|
|
70
|
-
@selector = 0
|
|
71
|
-
@answer << c
|
|
72
|
-
nil
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|