utils 0.22.1 → 0.24.0
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/VERSION +1 -1
- data/bin/all_images +82 -0
- data/bin/fix-brew +5 -0
- data/bin/irb_connect +3 -4
- data/bin/path +1 -1
- data/lib/utils/version.rb +1 -1
- data/utils.gemspec +6 -6
- metadata +29 -49
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93c2b093fc90b31c8fa1688487e2d9661fc31bcb33b8e21c73f1e21b55cccf40
|
|
4
|
+
data.tar.gz: 3b3089d78b393d59e40fbb98b0391c4aae02e0e0ceabf0c0dfd76258e6174d65
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f656d22fa84b868c1eee192610127164aed173d340e50e47f9583faab065e822826d417fcf1ed103f0dc84678849940acf55878458f4181198d702ed765eef58
|
|
7
|
+
data.tar.gz: 49313b75f55b653a495138f829708431ebefe4cbe8b29991c5c0524f6fb2fc4749cf5647c2aa6be5fb183821e3a0487da7ea10280b30f4088b763aa283dfefd5
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.24.0
|
data/bin/all_images
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# Configure like so:
|
|
3
|
+
# dockerfile: |-
|
|
4
|
+
# RUN apk add --no-cache build-base git
|
|
5
|
+
# RUN gem install gem_hadar bundler
|
|
6
|
+
#
|
|
7
|
+
# script: &script |-
|
|
8
|
+
# ruby -v
|
|
9
|
+
# rake test
|
|
10
|
+
#
|
|
11
|
+
# images:
|
|
12
|
+
# ruby:3.0-alpine: *script
|
|
13
|
+
# ruby:2.7-alpine: *script
|
|
14
|
+
# ruby:2.6-alpine: *script
|
|
15
|
+
# ruby:2.5-alpine: *script
|
|
16
|
+
# ruby:2.4-alpine: *script
|
|
17
|
+
# ruby:2.3-alpine: *script
|
|
18
|
+
|
|
19
|
+
require 'yaml'
|
|
20
|
+
require 'tmpdir'
|
|
21
|
+
require 'fileutils'
|
|
22
|
+
include FileUtils
|
|
23
|
+
|
|
24
|
+
alias sh system
|
|
25
|
+
dockerfile: |-
|
|
26
|
+
RUN apk add --no-cache build-base git
|
|
27
|
+
RUN gem install gem_hadar bundler
|
|
28
|
+
|
|
29
|
+
script: &script |-
|
|
30
|
+
ruby -v
|
|
31
|
+
rake test
|
|
32
|
+
|
|
33
|
+
images:
|
|
34
|
+
ruby:3.0-alpine: *script
|
|
35
|
+
ruby:2.7-alpine: *script
|
|
36
|
+
ruby:2.6-alpine: *script
|
|
37
|
+
ruby:2.5-alpine: *script
|
|
38
|
+
ruby:2.4-alpine: *script
|
|
39
|
+
ruby:2.3-alpine: *script
|
|
40
|
+
|
|
41
|
+
def provide_image(image, dockerfile)
|
|
42
|
+
tag = "all_images/#{image}"
|
|
43
|
+
sh "docker pull '#{image}'"
|
|
44
|
+
build_dir = File.join(Dir.tmpdir, 'build')
|
|
45
|
+
mkdir_p build_dir
|
|
46
|
+
cd build_dir do
|
|
47
|
+
File.open('Dockerfile', 'w') do |t|
|
|
48
|
+
t.puts <<~end
|
|
49
|
+
FROM #{image}
|
|
50
|
+
|
|
51
|
+
WORKDIR /work
|
|
52
|
+
|
|
53
|
+
#{dockerfile}
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
sh "docker build -t '#{tag}' ."
|
|
57
|
+
end
|
|
58
|
+
tag
|
|
59
|
+
ensure
|
|
60
|
+
rm_rf File.join(Dir.tmpdir, 'build')
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def red(string)
|
|
64
|
+
"\e[31m#{string}\e[0m"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def green(string)
|
|
68
|
+
"\e[32m#{string}\e[0m"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
config = YAML.load_file(ARGV.shift || '.all_images.yml')
|
|
72
|
+
dockerfile = config['dockerfile'].to_s
|
|
73
|
+
Array(config['images']).each do |image, script|
|
|
74
|
+
tag = provide_image image, dockerfile
|
|
75
|
+
if sh "docker run --name all_images -v `pwd`:/work '#{tag}' sh -c '#{script}'"
|
|
76
|
+
puts green('SUCCESS')
|
|
77
|
+
else
|
|
78
|
+
puts red('FAILURE')
|
|
79
|
+
end
|
|
80
|
+
ensure
|
|
81
|
+
sh 'docker rm -f all_images >/dev/null'
|
|
82
|
+
end
|
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/version.rb
CHANGED
data/utils.gemspec
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: utils 0.
|
|
2
|
+
# stub: utils 0.24.0 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.24.0"
|
|
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 = "
|
|
11
|
+
s.date = "2021-12-27"
|
|
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 = ["
|
|
14
|
+
s.executables = ["all_images".freeze, "ascii7".freeze, "blameline".freeze, "classify".freeze, "create_cstags".freeze, "create_tags".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "fix-brew".freeze, "git-empty".freeze, "git-versions".freeze, "irb_connect".freeze, "json_check".freeze, "long_lines".freeze, "myex".freeze, "number_files".freeze, "on_change".freeze, "path".freeze, "probe".freeze, "search".freeze, "sedit".freeze, "serve".freeze, "ssh-tunnel".freeze, "strip_spaces".freeze, "untest".freeze, "utils-utilsrc".freeze, "vcf2alias".freeze]
|
|
15
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/
|
|
16
|
+
s.files = [".gitignore".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/all_images".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
|
-
s.rubygems_version = "3.
|
|
19
|
+
s.rubygems_version = "3.2.22".freeze
|
|
20
20
|
s.summary = "Some useful command line utilities".freeze
|
|
21
21
|
|
|
22
22
|
if s.respond_to? :specification_version then
|
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.24.0
|
|
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:
|
|
11
|
+
date: 2021-12-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gem_hadar
|
|
@@ -111,45 +111,35 @@ dependencies:
|
|
|
111
111
|
description: This ruby gem provides some useful command line utilities
|
|
112
112
|
email: flori@ping.de
|
|
113
113
|
executables:
|
|
114
|
-
-
|
|
115
|
-
- classify
|
|
116
|
-
- sedit
|
|
117
|
-
- irb_connect
|
|
114
|
+
- all_images
|
|
118
115
|
- ascii7
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
- brakeman2err
|
|
125
|
-
- search
|
|
126
|
-
- chroot-exec
|
|
116
|
+
- blameline
|
|
117
|
+
- classify
|
|
118
|
+
- create_cstags
|
|
119
|
+
- create_tags
|
|
120
|
+
- discover
|
|
127
121
|
- edit
|
|
128
|
-
- tmproc
|
|
129
|
-
- json_check
|
|
130
122
|
- edit_wait
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
- blameline
|
|
134
|
-
- remote_copy
|
|
123
|
+
- enum
|
|
124
|
+
- fix-brew
|
|
135
125
|
- git-empty
|
|
136
|
-
- create_cstags
|
|
137
|
-
- vacuum_firefox_sqlite
|
|
138
|
-
- same_files
|
|
139
|
-
- chroot-libs
|
|
140
126
|
- git-versions
|
|
141
|
-
-
|
|
127
|
+
- irb_connect
|
|
128
|
+
- json_check
|
|
129
|
+
- long_lines
|
|
130
|
+
- myex
|
|
142
131
|
- number_files
|
|
143
|
-
- rssr
|
|
144
|
-
- serve
|
|
145
|
-
- vcf2alias
|
|
146
132
|
- on_change
|
|
147
|
-
-
|
|
148
|
-
- myex
|
|
149
|
-
- long_lines
|
|
150
|
-
- dialog-pick
|
|
133
|
+
- path
|
|
151
134
|
- probe
|
|
152
|
-
-
|
|
135
|
+
- search
|
|
136
|
+
- sedit
|
|
137
|
+
- serve
|
|
138
|
+
- ssh-tunnel
|
|
139
|
+
- strip_spaces
|
|
140
|
+
- untest
|
|
141
|
+
- utils-utilsrc
|
|
142
|
+
- vcf2alias
|
|
153
143
|
extensions: []
|
|
154
144
|
extra_rdoc_files:
|
|
155
145
|
- README.md
|
|
@@ -176,20 +166,17 @@ files:
|
|
|
176
166
|
- README.md
|
|
177
167
|
- Rakefile
|
|
178
168
|
- VERSION
|
|
169
|
+
- bin/all_images
|
|
179
170
|
- bin/ascii7
|
|
180
171
|
- bin/blameline
|
|
181
|
-
- bin/brakeman2err
|
|
182
|
-
- bin/chroot-exec
|
|
183
|
-
- bin/chroot-libs
|
|
184
172
|
- bin/classify
|
|
185
173
|
- bin/create_cstags
|
|
186
174
|
- bin/create_tags
|
|
187
|
-
- bin/dialog-pick
|
|
188
175
|
- bin/discover
|
|
189
176
|
- bin/edit
|
|
190
177
|
- bin/edit_wait
|
|
191
178
|
- bin/enum
|
|
192
|
-
- bin/
|
|
179
|
+
- bin/fix-brew
|
|
193
180
|
- bin/git-empty
|
|
194
181
|
- bin/git-versions
|
|
195
182
|
- bin/irb_connect
|
|
@@ -200,21 +187,14 @@ files:
|
|
|
200
187
|
- bin/on_change
|
|
201
188
|
- bin/path
|
|
202
189
|
- bin/probe
|
|
203
|
-
- bin/remote_copy
|
|
204
|
-
- bin/rssr
|
|
205
|
-
- bin/same_files
|
|
206
190
|
- bin/search
|
|
207
191
|
- bin/sedit
|
|
208
192
|
- bin/serve
|
|
209
193
|
- bin/ssh-tunnel
|
|
210
194
|
- bin/strip_spaces
|
|
211
|
-
- bin/tmproc
|
|
212
|
-
- bin/unquarantine_apps
|
|
213
195
|
- bin/untest
|
|
214
196
|
- bin/utils-utilsrc
|
|
215
|
-
- bin/vacuum_firefox_sqlite
|
|
216
197
|
- bin/vcf2alias
|
|
217
|
-
- bin/xmp
|
|
218
198
|
- lib/utils.rb
|
|
219
199
|
- lib/utils/config_file.rb
|
|
220
200
|
- lib/utils/editor.rb
|
|
@@ -235,7 +215,7 @@ files:
|
|
|
235
215
|
homepage: http://github.com/flori/utils
|
|
236
216
|
licenses: []
|
|
237
217
|
metadata: {}
|
|
238
|
-
post_install_message:
|
|
218
|
+
post_install_message:
|
|
239
219
|
rdoc_options:
|
|
240
220
|
- "--title"
|
|
241
221
|
- Utils - Some useful command line utilities
|
|
@@ -254,8 +234,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
254
234
|
- !ruby/object:Gem::Version
|
|
255
235
|
version: '0'
|
|
256
236
|
requirements: []
|
|
257
|
-
rubygems_version: 3.
|
|
258
|
-
signing_key:
|
|
237
|
+
rubygems_version: 3.2.22
|
|
238
|
+
signing_key:
|
|
259
239
|
specification_version: 4
|
|
260
240
|
summary: Some useful command line utilities
|
|
261
241
|
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
|