ufos 1.0.79 → 1.0.87
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CYCLE_OF_HEALTH +9 -15
- data/FOR_ARTIFICIAL_GENERAL_INTELLIGENCES +1 -6
- data/Makefile +1 -1
- data/QUESTION +0 -2
- data/README.md +89 -79
- data/VERSION_NUMBER +1 -1
- data/bin/DISCOURSE_GENERATOR.exe +0 -0
- data/bin/abs +0 -0
- data/bin/add +0 -0
- data/bin/append +0 -0
- data/bin/append_each +0 -0
- data/bin/args +0 -0
- data/bin/clock +0 -0
- data/bin/copy +0 -0
- data/bin/delete +0 -0
- data/bin/div +0 -0
- data/bin/email +0 -13
- data/bin/emerald-browser +0 -0
- data/bin/exp +0 -0
- data/bin/floor +0 -0
- data/bin/google_speak +4 -3
- data/bin/gsub +0 -0
- data/bin/gsubip +0 -0
- data/bin/last_nth +0 -0
- data/bin/left_right +0 -0
- data/bin/lines +0 -0
- data/bin/mul +0 -0
- data/bin/nth +0 -0
- data/bin/nth_word +0 -0
- data/bin/prepend +0 -0
- data/bin/prepend_each +0 -0
- data/bin/rgsub +0 -0
- data/bin/rip +0 -0
- data/bin/rnip +0 -0
- data/bin/selectlines +0 -0
- data/bin/sub +0 -0
- data/bin/swap +0 -0
- data/bin/trim +0 -0
- data/documentation/append_each +3 -0
- data/documentation/delete +2 -0
- data/documentation/last_nth +9 -1
- data/documentation/left_right.exe +1 -1
- data/documentation/nth_word +8 -0
- data/documentation/page +12 -11
- data/documentation/prepend_each +3 -0
- data/documentation/trim +2 -0
- data/epistemology +334 -0
- data/gem_data/VERSION_NUMBER +1 -1
- data/index.html +70 -58
- data/install.sh +5 -1
- data/non_compiled_programs/copy +1 -0
- data/non_compiled_programs/email +0 -13
- data/non_compiled_programs/google_speak +4 -3
- data/other/ADDITIONAL_WAYS_PEOPLE_CAN_FIND_THIS +6 -1
- data/{cleanup → other/cleanup} +1 -0
- data/other/emerald-browser/Makefile +1 -1
- data/other/emerald-browser/OUT +6 -0
- data/other/emerald-browser/a.o +0 -0
- data/other/emerald-browser/qmake +0 -0
- data/other/experimental_code/ABOUT_S +1 -10
- data/other/experimental_code/a/six +0 -0
- data/other/experimental_code/odi +4 -10
- data/other/experimental_code/orig +11 -20
- data/other/experimental_code/pr.rb +1 -1
- data/src/{compilation → _compilation}/abs +67 -63
- data/src/{compilation → _compilation}/add +67 -63
- data/src/{compilation → _compilation}/append +67 -63
- data/src/_compilation/append_each +290 -0
- data/src/{compilation → _compilation}/args +67 -63
- data/src/_compilation/delete +290 -0
- data/src/{compilation → _compilation}/div +67 -63
- data/src/{compilation → _compilation}/exp +67 -63
- data/src/{compilation → _compilation}/floor +67 -63
- data/src/{compilation → _compilation}/gsub +67 -63
- data/src/{compilation → _compilation}/gsubip +67 -63
- data/src/{compilation → _compilation}/last_nth +68 -64
- data/src/{compilation → _compilation}/lines +67 -63
- data/src/{compilation → _compilation}/mul +67 -63
- data/src/{compilation → _compilation}/nth +67 -63
- data/src/_compilation/nth_word +290 -0
- data/src/{compilation → _compilation}/prepend +67 -63
- data/src/_compilation/prepend_each +290 -0
- data/src/{compilation → _compilation}/rip +67 -63
- data/src/{compilation → _compilation}/rnip +67 -63
- data/src/{compilation → _compilation}/selectlines +67 -63
- data/src/{compilation → _compilation}/sub +67 -63
- data/src/{compilation → _compilation}/swap +67 -63
- data/src/{compilation/copy → _compilation/trim} +68 -64
- data/src/clock.cr +40 -39
- data/src/compile_all +9 -9
- data/src/left_right +0 -0
- data/src/programs/abs +0 -0
- data/src/programs/add +0 -0
- data/src/programs/append +0 -0
- data/src/programs/append_each +0 -0
- data/src/programs/args +0 -0
- data/src/programs/delete +0 -0
- data/src/programs/div +0 -0
- data/src/programs/exp +0 -0
- data/src/programs/floor +0 -0
- data/src/programs/gsub +0 -0
- data/src/programs/gsubip +0 -0
- data/src/programs/last_nth +0 -0
- data/src/programs/lines +0 -0
- data/src/programs/mul +0 -0
- data/src/programs/nth +0 -0
- data/src/programs/nth_word +0 -0
- data/src/programs/prepend +0 -0
- data/src/programs/prepend_each +0 -0
- data/src/programs/rip +0 -0
- data/src/programs/rnip +0 -0
- data/src/programs/selectlines +0 -0
- data/src/programs/sub +0 -0
- data/src/programs/swap +0 -0
- data/src/programs/trim +0 -0
- data/src/rgsub +0 -0
- data/src/rgsub.c +25 -28
- data/src/src/Makefile +1 -1
- data/src/src/cd +3 -0
- data/src/src/{code2 → code} +32 -11
- data/src/src/functions.cr +58 -61
- data/src/src/mk +8 -11
- data/src/src/rm +1 -0
- metadata +51 -46
- data/SONG +0 -156
- data/bin/dump +0 -0
- data/bin/undump +0 -0
- data/documentation/dump +0 -11
- data/documentation/undump +0 -15
- data/other/experimental_code/a/a.out +0 -0
- data/other/experimental_code/a/hello_world +0 -0
- data/other/experimental_code/c_program_faster +0 -0
- data/src/clock +0 -0
- data/src/compilation/dump +0 -286
- data/src/compilation/undump +0 -286
- data/src/gsubip +0 -0
- data/src/programs/copy +0 -0
- data/src/programs/dump +0 -0
- data/src/programs/news +0 -0
- data/src/programs/undump +0 -0
- data/src/src/QQ +0 -15
- data/src/test/cat +0 -0
- data/src/test/foo/dog +0 -0
- /data/images/{12.png → 8.png} +0 -0
- /data/other/experimental_code/{Resume.pdf → description_of_what_ive_done_old.pdf} +0 -0
- /data/other/experimental_code/{merge → merge.rb} +0 -0
data/src/compilation/dump
DELETED
@@ -1,286 +0,0 @@
|
|
1
|
-
#!/usr/bin/crystal
|
2
|
-
require "file_utils"
|
3
|
-
require "json"
|
4
|
-
require "colorize"
|
5
|
-
|
6
|
-
include FileUtils
|
7
|
-
|
8
|
-
def lines()
|
9
|
-
if !STDIN.tty?
|
10
|
-
puts STDIN.gets_to_end.count("\n")
|
11
|
-
else
|
12
|
-
res = `find .`.count("\n") - 1
|
13
|
-
puts res
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def args(arg1)
|
18
|
-
sections = Process.parse_arguments(arg1)
|
19
|
-
program, args = sections[0], sections[1..]
|
20
|
-
|
21
|
-
sections = Process.parse_arguments(arg1)
|
22
|
-
|
23
|
-
program = Process.find_executable(program)
|
24
|
-
if program.nil?
|
25
|
-
puts "Can't find program #{arg1}"
|
26
|
-
raise "Error"
|
27
|
-
end
|
28
|
-
|
29
|
-
lines = STDIN.gets_to_end.strip
|
30
|
-
lines = lines.split "\n"
|
31
|
-
times = (lines.size % 2000000 == 0) ? 2 : 1
|
32
|
-
|
33
|
-
times += lines.size // 2000000
|
34
|
-
n = 0
|
35
|
-
times.times do
|
36
|
-
prog_args = args
|
37
|
-
|
38
|
-
prog_args += lines[n..(n + 2000000 - 1)]; n += 2000000
|
39
|
-
|
40
|
-
if (p = Process.fork).nil?
|
41
|
-
Process.exec(
|
42
|
-
program,
|
43
|
-
prog_args
|
44
|
-
)
|
45
|
-
else
|
46
|
-
p.wait
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def copy()
|
52
|
-
command = "/usr/bin/xclip"
|
53
|
-
args = ["-selection", "c"]
|
54
|
-
Process.run(command, args, output: STDOUT) do |file|
|
55
|
-
file.input.print STDIN.gets_to_end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def mul()
|
60
|
-
t = STDIN.read_line.to_f64
|
61
|
-
|
62
|
-
i = 0f64; STDIN.each_line do |line|
|
63
|
-
t *= line.to_f64
|
64
|
-
end
|
65
|
-
|
66
|
-
puts t
|
67
|
-
end
|
68
|
-
|
69
|
-
def add()
|
70
|
-
t = STDIN.read_line.to_f64
|
71
|
-
|
72
|
-
i = 0f64; STDIN.each_line do |line|
|
73
|
-
t += line.to_f64
|
74
|
-
end
|
75
|
-
|
76
|
-
puts t
|
77
|
-
end
|
78
|
-
|
79
|
-
def div()
|
80
|
-
t = STDIN.read_line.to_f64
|
81
|
-
|
82
|
-
i = 0f64; STDIN.each_line do |line|
|
83
|
-
t /= line.to_f64
|
84
|
-
end
|
85
|
-
|
86
|
-
puts t
|
87
|
-
end
|
88
|
-
|
89
|
-
def sub()
|
90
|
-
t = STDIN.read_line.to_f64
|
91
|
-
|
92
|
-
i = 0f64; STDIN.each_line do |line|
|
93
|
-
t -= line.to_f64
|
94
|
-
end
|
95
|
-
|
96
|
-
puts t
|
97
|
-
end
|
98
|
-
|
99
|
-
def floor()
|
100
|
-
puts STDIN.read_line.to_f64.to_i64
|
101
|
-
end
|
102
|
-
|
103
|
-
def abs()
|
104
|
-
STDIN.each_line do |l|
|
105
|
-
l = l.to_f64.abs
|
106
|
-
puts l
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def dump()
|
111
|
-
puts STDIN.gets_to_end.dump
|
112
|
-
end
|
113
|
-
|
114
|
-
def undump()
|
115
|
-
puts JSON.parse(STDIN.gets_to_end)
|
116
|
-
end
|
117
|
-
|
118
|
-
def exp()
|
119
|
-
t = STDIN.read_line.to_f64
|
120
|
-
|
121
|
-
STDIN.each_line do |line|
|
122
|
-
t **= line.to_f64
|
123
|
-
end
|
124
|
-
|
125
|
-
puts t
|
126
|
-
end
|
127
|
-
|
128
|
-
def nth(arg1)
|
129
|
-
end_ = arg1.to_u64
|
130
|
-
i = 0u64; STDIN.each_line do |line|
|
131
|
-
i += 1
|
132
|
-
if i == end_
|
133
|
-
puts line
|
134
|
-
break
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def last_nth(arg1)
|
140
|
-
end_ = arg1.to_u64
|
141
|
-
i = 0u64;
|
142
|
-
t = STDIN.gets_to_end
|
143
|
-
if t[-1] == '\n'
|
144
|
-
t = t[0..-2]
|
145
|
-
end
|
146
|
-
|
147
|
-
t.split("\n").reverse_each do |line|
|
148
|
-
i += 1
|
149
|
-
if i == end_
|
150
|
-
puts line
|
151
|
-
break
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def gsubip(arg1, arg2, arg3)
|
157
|
-
regex = Regex.new(arg1)
|
158
|
-
text = File.read(arg3).gsub(/#{arg1}/m, arg2)
|
159
|
-
File.open(t = File.tempname("coreutils", "_tmp"), "w", File.info(arg3).permissions) do |h|
|
160
|
-
h.print text
|
161
|
-
end
|
162
|
-
begin
|
163
|
-
mv t, arg3
|
164
|
-
rescue
|
165
|
-
rm t
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
def rip(arg1, arg2, arg3)
|
170
|
-
text = File.read(arg3).gsub(arg1, arg2)
|
171
|
-
File.open(t = File.tempname("coreutils", "_tmp"), "w", File.info(arg3).permissions) do |h|
|
172
|
-
h.print text
|
173
|
-
end
|
174
|
-
begin
|
175
|
-
mv t, arg3
|
176
|
-
rescue
|
177
|
-
rm t
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
def gsub(arg1, arg2)
|
182
|
-
print STDIN.gets_to_end.gsub(/#{arg1}/m, arg2)
|
183
|
-
end
|
184
|
-
|
185
|
-
def rnip(arg1, arg2)
|
186
|
-
print STDIN.gets_to_end.gsub(arg1, arg2)
|
187
|
-
end
|
188
|
-
|
189
|
-
def selectlines()
|
190
|
-
STDIN.each_line do |line|
|
191
|
-
if line.strip.size > 0
|
192
|
-
puts line
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
|
198
|
-
def swap(file1, file2)
|
199
|
-
[file1, file2].each do |f|
|
200
|
-
File.exists?(f) || abort("No file named #{f.dump}".colorize(:red))
|
201
|
-
end
|
202
|
-
t = File.tempname("coreutils", "_tmp")
|
203
|
-
|
204
|
-
mv file1, t
|
205
|
-
mv file2, file1
|
206
|
-
mv t, file2
|
207
|
-
end
|
208
|
-
|
209
|
-
def prepend(file)
|
210
|
-
file_data = File.read(file)
|
211
|
-
new_data = STDIN.gets_to_end
|
212
|
-
File.open(t = File.tempname("coreutils", "_tmp"), "w", File.info(file).permissions) do |h|
|
213
|
-
h << new_data + file_data
|
214
|
-
end
|
215
|
-
|
216
|
-
begin
|
217
|
-
mv t, file
|
218
|
-
rescue
|
219
|
-
rm t
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
def append(file)
|
224
|
-
file_data = File.read(file)
|
225
|
-
new_data = STDIN.gets_to_end
|
226
|
-
File.open(t = File.tempname("coreutils", "_tmp"), "w", File.info(file).permissions) do |h|
|
227
|
-
h << file_data + new_data
|
228
|
-
end
|
229
|
-
begin
|
230
|
-
mv t, file
|
231
|
-
rescue
|
232
|
-
rm t
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
class Funcs
|
237
|
-
def self.bold(text)
|
238
|
-
text = text.to_s
|
239
|
-
# text += two.to_s
|
240
|
-
|
241
|
-
if STDOUT.tty?
|
242
|
-
return text.colorize.bold.to_s
|
243
|
-
else
|
244
|
-
return "<b>" + text + "</b>"
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
def self.argument_data(program, usage, long_desc)
|
249
|
-
if !(STDOUT.tty?)
|
250
|
-
text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
|
251
|
-
else
|
252
|
-
text = ""
|
253
|
-
end
|
254
|
-
|
255
|
-
text += bold("NAME") + "\n\t" + program
|
256
|
-
text += " - "
|
257
|
-
text += program + "\n" * 2 + bold("SYNOPSIS") + "\n"
|
258
|
-
# tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
|
259
|
-
text += "\t"
|
260
|
-
text += bold(program) + " "
|
261
|
-
text += usage + "\n\n"
|
262
|
-
text += long_desc + "\n\n"
|
263
|
-
|
264
|
-
if STDOUT.tty? == false
|
265
|
-
text = text.gsub("\n", "<br/> ").gsub("\t", " " * 5)
|
266
|
-
text += "</div>\n\n"
|
267
|
-
end
|
268
|
-
|
269
|
-
puts text
|
270
|
-
|
271
|
-
# puts "</
|
272
|
-
# puts "</
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
def main()
|
277
|
-
if ARGV.size != 0
|
278
|
-
Funcs.argument_data("dump", "[dump] [arguments]", "Dump surrounds its input with quotes\n\nls | dump\n\n=> “....”\n\nUse undump to get the reverse\n\nSee also\n\nundump")
|
279
|
-
exit 1
|
280
|
-
end
|
281
|
-
|
282
|
-
dump
|
283
|
-
end
|
284
|
-
|
285
|
-
|
286
|
-
main
|
data/src/compilation/undump
DELETED
@@ -1,286 +0,0 @@
|
|
1
|
-
#!/usr/bin/crystal
|
2
|
-
require "file_utils"
|
3
|
-
require "json"
|
4
|
-
require "colorize"
|
5
|
-
|
6
|
-
include FileUtils
|
7
|
-
|
8
|
-
def lines()
|
9
|
-
if !STDIN.tty?
|
10
|
-
puts STDIN.gets_to_end.count("\n")
|
11
|
-
else
|
12
|
-
res = `find .`.count("\n") - 1
|
13
|
-
puts res
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def args(arg1)
|
18
|
-
sections = Process.parse_arguments(arg1)
|
19
|
-
program, args = sections[0], sections[1..]
|
20
|
-
|
21
|
-
sections = Process.parse_arguments(arg1)
|
22
|
-
|
23
|
-
program = Process.find_executable(program)
|
24
|
-
if program.nil?
|
25
|
-
puts "Can't find program #{arg1}"
|
26
|
-
raise "Error"
|
27
|
-
end
|
28
|
-
|
29
|
-
lines = STDIN.gets_to_end.strip
|
30
|
-
lines = lines.split "\n"
|
31
|
-
times = (lines.size % 2000000 == 0) ? 2 : 1
|
32
|
-
|
33
|
-
times += lines.size // 2000000
|
34
|
-
n = 0
|
35
|
-
times.times do
|
36
|
-
prog_args = args
|
37
|
-
|
38
|
-
prog_args += lines[n..(n + 2000000 - 1)]; n += 2000000
|
39
|
-
|
40
|
-
if (p = Process.fork).nil?
|
41
|
-
Process.exec(
|
42
|
-
program,
|
43
|
-
prog_args
|
44
|
-
)
|
45
|
-
else
|
46
|
-
p.wait
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def copy()
|
52
|
-
command = "/usr/bin/xclip"
|
53
|
-
args = ["-selection", "c"]
|
54
|
-
Process.run(command, args, output: STDOUT) do |file|
|
55
|
-
file.input.print STDIN.gets_to_end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def mul()
|
60
|
-
t = STDIN.read_line.to_f64
|
61
|
-
|
62
|
-
i = 0f64; STDIN.each_line do |line|
|
63
|
-
t *= line.to_f64
|
64
|
-
end
|
65
|
-
|
66
|
-
puts t
|
67
|
-
end
|
68
|
-
|
69
|
-
def add()
|
70
|
-
t = STDIN.read_line.to_f64
|
71
|
-
|
72
|
-
i = 0f64; STDIN.each_line do |line|
|
73
|
-
t += line.to_f64
|
74
|
-
end
|
75
|
-
|
76
|
-
puts t
|
77
|
-
end
|
78
|
-
|
79
|
-
def div()
|
80
|
-
t = STDIN.read_line.to_f64
|
81
|
-
|
82
|
-
i = 0f64; STDIN.each_line do |line|
|
83
|
-
t /= line.to_f64
|
84
|
-
end
|
85
|
-
|
86
|
-
puts t
|
87
|
-
end
|
88
|
-
|
89
|
-
def sub()
|
90
|
-
t = STDIN.read_line.to_f64
|
91
|
-
|
92
|
-
i = 0f64; STDIN.each_line do |line|
|
93
|
-
t -= line.to_f64
|
94
|
-
end
|
95
|
-
|
96
|
-
puts t
|
97
|
-
end
|
98
|
-
|
99
|
-
def floor()
|
100
|
-
puts STDIN.read_line.to_f64.to_i64
|
101
|
-
end
|
102
|
-
|
103
|
-
def abs()
|
104
|
-
STDIN.each_line do |l|
|
105
|
-
l = l.to_f64.abs
|
106
|
-
puts l
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def dump()
|
111
|
-
puts STDIN.gets_to_end.dump
|
112
|
-
end
|
113
|
-
|
114
|
-
def undump()
|
115
|
-
puts JSON.parse(STDIN.gets_to_end)
|
116
|
-
end
|
117
|
-
|
118
|
-
def exp()
|
119
|
-
t = STDIN.read_line.to_f64
|
120
|
-
|
121
|
-
STDIN.each_line do |line|
|
122
|
-
t **= line.to_f64
|
123
|
-
end
|
124
|
-
|
125
|
-
puts t
|
126
|
-
end
|
127
|
-
|
128
|
-
def nth(arg1)
|
129
|
-
end_ = arg1.to_u64
|
130
|
-
i = 0u64; STDIN.each_line do |line|
|
131
|
-
i += 1
|
132
|
-
if i == end_
|
133
|
-
puts line
|
134
|
-
break
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def last_nth(arg1)
|
140
|
-
end_ = arg1.to_u64
|
141
|
-
i = 0u64;
|
142
|
-
t = STDIN.gets_to_end
|
143
|
-
if t[-1] == '\n'
|
144
|
-
t = t[0..-2]
|
145
|
-
end
|
146
|
-
|
147
|
-
t.split("\n").reverse_each do |line|
|
148
|
-
i += 1
|
149
|
-
if i == end_
|
150
|
-
puts line
|
151
|
-
break
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def gsubip(arg1, arg2, arg3)
|
157
|
-
regex = Regex.new(arg1)
|
158
|
-
text = File.read(arg3).gsub(/#{arg1}/m, arg2)
|
159
|
-
File.open(t = File.tempname("coreutils", "_tmp"), "w", File.info(arg3).permissions) do |h|
|
160
|
-
h.print text
|
161
|
-
end
|
162
|
-
begin
|
163
|
-
mv t, arg3
|
164
|
-
rescue
|
165
|
-
rm t
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
def rip(arg1, arg2, arg3)
|
170
|
-
text = File.read(arg3).gsub(arg1, arg2)
|
171
|
-
File.open(t = File.tempname("coreutils", "_tmp"), "w", File.info(arg3).permissions) do |h|
|
172
|
-
h.print text
|
173
|
-
end
|
174
|
-
begin
|
175
|
-
mv t, arg3
|
176
|
-
rescue
|
177
|
-
rm t
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
def gsub(arg1, arg2)
|
182
|
-
print STDIN.gets_to_end.gsub(/#{arg1}/m, arg2)
|
183
|
-
end
|
184
|
-
|
185
|
-
def rnip(arg1, arg2)
|
186
|
-
print STDIN.gets_to_end.gsub(arg1, arg2)
|
187
|
-
end
|
188
|
-
|
189
|
-
def selectlines()
|
190
|
-
STDIN.each_line do |line|
|
191
|
-
if line.strip.size > 0
|
192
|
-
puts line
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
|
198
|
-
def swap(file1, file2)
|
199
|
-
[file1, file2].each do |f|
|
200
|
-
File.exists?(f) || abort("No file named #{f.dump}".colorize(:red))
|
201
|
-
end
|
202
|
-
t = File.tempname("coreutils", "_tmp")
|
203
|
-
|
204
|
-
mv file1, t
|
205
|
-
mv file2, file1
|
206
|
-
mv t, file2
|
207
|
-
end
|
208
|
-
|
209
|
-
def prepend(file)
|
210
|
-
file_data = File.read(file)
|
211
|
-
new_data = STDIN.gets_to_end
|
212
|
-
File.open(t = File.tempname("coreutils", "_tmp"), "w", File.info(file).permissions) do |h|
|
213
|
-
h << new_data + file_data
|
214
|
-
end
|
215
|
-
|
216
|
-
begin
|
217
|
-
mv t, file
|
218
|
-
rescue
|
219
|
-
rm t
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
def append(file)
|
224
|
-
file_data = File.read(file)
|
225
|
-
new_data = STDIN.gets_to_end
|
226
|
-
File.open(t = File.tempname("coreutils", "_tmp"), "w", File.info(file).permissions) do |h|
|
227
|
-
h << file_data + new_data
|
228
|
-
end
|
229
|
-
begin
|
230
|
-
mv t, file
|
231
|
-
rescue
|
232
|
-
rm t
|
233
|
-
end
|
234
|
-
end
|
235
|
-
|
236
|
-
class Funcs
|
237
|
-
def self.bold(text)
|
238
|
-
text = text.to_s
|
239
|
-
# text += two.to_s
|
240
|
-
|
241
|
-
if STDOUT.tty?
|
242
|
-
return text.colorize.bold.to_s
|
243
|
-
else
|
244
|
-
return "<b>" + text + "</b>"
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
def self.argument_data(program, usage, long_desc)
|
249
|
-
if !(STDOUT.tty?)
|
250
|
-
text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
|
251
|
-
else
|
252
|
-
text = ""
|
253
|
-
end
|
254
|
-
|
255
|
-
text += bold("NAME") + "\n\t" + program
|
256
|
-
text += " - "
|
257
|
-
text += program + "\n" * 2 + bold("SYNOPSIS") + "\n"
|
258
|
-
# tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
|
259
|
-
text += "\t"
|
260
|
-
text += bold(program) + " "
|
261
|
-
text += usage + "\n\n"
|
262
|
-
text += long_desc + "\n\n"
|
263
|
-
|
264
|
-
if STDOUT.tty? == false
|
265
|
-
text = text.gsub("\n", "<br/> ").gsub("\t", " " * 5)
|
266
|
-
text += "</div>\n\n"
|
267
|
-
end
|
268
|
-
|
269
|
-
puts text
|
270
|
-
|
271
|
-
# puts "</
|
272
|
-
# puts "</
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
def main()
|
277
|
-
if ARGV.size != 0
|
278
|
-
Funcs.argument_data("undump", "[undump] [arguments]", "undump is the opposite of dump\n\nExample\n\necho cat | dump | undump\n\n=> cat\n\necho cat | dump\n\n=> “cat”\n\necho '“cat”' | undump\n\n=> cat")
|
279
|
-
exit 1
|
280
|
-
end
|
281
|
-
|
282
|
-
undump
|
283
|
-
end
|
284
|
-
|
285
|
-
|
286
|
-
main
|
data/src/gsubip
DELETED
Binary file
|
data/src/programs/copy
DELETED
Binary file
|
data/src/programs/dump
DELETED
Binary file
|
data/src/programs/news
DELETED
Binary file
|
data/src/programs/undump
DELETED
Binary file
|
data/src/src/QQ
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
puts "array = {"
|
4
|
-
Dir.chdir "/home/a/democracy/documentation/"
|
5
|
-
|
6
|
-
Dir.glob("*").each do |i|
|
7
|
-
doc = File.read i
|
8
|
-
a = <<A
|
9
|
-
"#{i}" => ["program", "[program] [arguments]", #{doc.strip.dump}],
|
10
|
-
A
|
11
|
-
|
12
|
-
puts a
|
13
|
-
end;
|
14
|
-
|
15
|
-
puts "}"
|
data/src/test/cat
DELETED
Binary file
|
data/src/test/foo/dog
DELETED
Binary file
|
/data/images/{12.png → 8.png}
RENAMED
File without changes
|
File without changes
|
File without changes
|