freespeech 1.0.79 → 1.0.82
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/FOR_ARTIFICIAL_GENERAL_INTELLIGENCES +1 -6
- data/QUESTION +0 -2
- data/README.md +55 -57
- 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/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/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/quot +6 -5
- 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/delete +2 -0
- data/documentation/last_nth +9 -1
- data/documentation/nth_word +8 -0
- data/documentation/page +43 -43
- data/documentation/trim +2 -0
- data/epistemology +334 -0
- data/gem_data/VERSION_NUMBER +1 -1
- data/index.html +96 -92
- data/non_compiled_programs/copy +1 -0
- data/non_compiled_programs/email +0 -13
- data/non_compiled_programs/quot +6 -5
- data/other/ADDITIONAL_WAYS_PEOPLE_CAN_FIND_THIS +6 -1
- 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/src/{compilation → _compilation}/abs +33 -48
- data/src/{compilation → _compilation}/add +33 -48
- data/src/{compilation → _compilation}/append +33 -48
- data/src/{compilation → _compilation}/args +33 -48
- data/src/_compilation/delete +271 -0
- data/src/{compilation → _compilation}/div +33 -48
- data/src/{compilation → _compilation}/exp +33 -48
- data/src/{compilation → _compilation}/floor +33 -48
- data/src/{compilation → _compilation}/gsub +33 -48
- data/src/{compilation → _compilation}/gsubip +33 -48
- data/src/{compilation → _compilation}/last_nth +34 -49
- data/src/{compilation → _compilation}/lines +33 -48
- data/src/{compilation → _compilation}/mul +33 -48
- data/src/{compilation → _compilation}/nth +33 -48
- data/src/_compilation/nth_word +271 -0
- data/src/{compilation → _compilation}/prepend +33 -48
- data/src/{compilation → _compilation}/rip +33 -48
- data/src/{compilation → _compilation}/rnip +33 -48
- data/src/{compilation → _compilation}/selectlines +33 -48
- data/src/{compilation → _compilation}/sub +33 -48
- data/src/{compilation → _compilation}/swap +33 -48
- data/src/{compilation/copy → _compilation/trim} +35 -50
- 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/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/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 +3 -5
- data/src/src/{code2 → code} +2 -2
- data/src/src/functions.cr +33 -49
- data/src/src/mk +2 -3
- data/src/src/q.cr +9 -0
- metadata +37 -38
- 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/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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xclip -selection c
|
data/non_compiled_programs/email
CHANGED
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
28
|
GREGORYS_USERNAME = 'a'
|
|
29
29
|
if File.basename(Dir.home) == GREGORYS_USERNAME
|
|
30
|
-
# if Dir.basename (Dir.home) == "a"
|
|
31
30
|
PERSON = 'Gregory'
|
|
32
31
|
EMAIL = 'gregorycohenvideos@gmail.com'
|
|
33
32
|
else
|
|
@@ -58,13 +57,10 @@ def main
|
|
|
58
57
|
end
|
|
59
58
|
end
|
|
60
59
|
|
|
61
|
-
# puts args.length
|
|
62
|
-
|
|
63
60
|
args = case args.length
|
|
64
61
|
when 0
|
|
65
62
|
["From #{PERSON}"] + args + [EMAIL.to_s]
|
|
66
63
|
when 1
|
|
67
|
-
# subject = "From Gregory"
|
|
68
64
|
["From #{PERSON}"] + args
|
|
69
65
|
else
|
|
70
66
|
args
|
|
@@ -80,17 +76,9 @@ def main
|
|
|
80
76
|
exit 1
|
|
81
77
|
end
|
|
82
78
|
require 'tempfile'
|
|
83
|
-
# STRING=
|
|
84
|
-
|
|
85
|
-
# puts args
|
|
86
|
-
# exit! 0
|
|
87
|
-
# pu
|
|
88
|
-
# puts args
|
|
89
79
|
raise if args.empty?
|
|
90
80
|
|
|
91
81
|
loop do
|
|
92
|
-
# "Loop"
|
|
93
|
-
# args
|
|
94
82
|
args[1..-1].each do |arg|
|
|
95
83
|
text = <<~EOF
|
|
96
84
|
To: <#{arg}>
|
|
@@ -99,7 +87,6 @@ def main
|
|
|
99
87
|
|
|
100
88
|
#{content.strip}
|
|
101
89
|
EOF
|
|
102
|
-
# puts text
|
|
103
90
|
Tempfile.open do |file|
|
|
104
91
|
puts attachments
|
|
105
92
|
require 'shellwords'
|
data/non_compiled_programs/quot
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
arg = ARGV[0]
|
|
5
|
+
val = if arg.nil?
|
|
5
6
|
$stdin.read
|
|
6
7
|
else
|
|
7
|
-
File.read(
|
|
8
|
+
File.read(arg)
|
|
8
9
|
end
|
|
9
10
|
|
|
10
|
-
d = (val.gsub(/".*?"/) do |i|
|
|
11
|
+
d = (val.gsub(/(?<=\s)".*?"/) do |i|
|
|
11
12
|
"“#{i[1..-2]}”"
|
|
12
13
|
end).gsub(/\s*”\s*([,.?!])/, '\\1”').gsub(/([ \t])[ \t]+/, '\\1').gsub(/\n\n\n*/, "\n\n").strip
|
|
13
14
|
|
|
14
|
-
if
|
|
15
|
+
if arg.nil?
|
|
15
16
|
print d
|
|
16
17
|
else
|
|
17
|
-
File.write
|
|
18
|
+
File.write arg, d
|
|
18
19
|
end
|
|
@@ -6,4 +6,9 @@ https://pypi.org/project/billgates
|
|
|
6
6
|
https://pypi.org/project/linustorvalds
|
|
7
7
|
|
|
8
8
|
https://rubygems.org/gems/elonmusk
|
|
9
|
-
https://rubygems.org/gems/freedom
|
|
9
|
+
https://rubygems.org/gems/freedom
|
|
10
|
+
|
|
11
|
+
https://rubygems.org/gems/politics
|
|
12
|
+
|
|
13
|
+
https://rubygems.org/gems/aliens
|
|
14
|
+
https://rubygems.org/gems/ufos
|
|
@@ -13,7 +13,7 @@ EQ = =
|
|
|
13
13
|
####### Compiler, tools and options
|
|
14
14
|
|
|
15
15
|
CC = gcc
|
|
16
|
-
CXX = g
|
|
16
|
+
CXX = g+
|
|
17
17
|
DEFINES = -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WEBENGINEWIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_WEBENGINECORE_LIB -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_POSITIONING_LIB -DQT_CORE_LIB
|
|
18
18
|
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
|
|
19
19
|
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
|
data/other/emerald-browser/a.o
CHANGED
|
Binary file
|
data/other/emerald-browser/qmake
CHANGED
|
Binary file
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/crystal
|
|
2
|
-
require "file_utils"
|
|
3
|
-
require "json"
|
|
4
|
-
require "colorize"
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
def delete(arg)
|
|
4
|
+
`find -name #{arg}`.each_line do |i|
|
|
5
|
+
File.delete(i)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def nth_word(arg)
|
|
11
|
+
i = arg.to_u64 - 1
|
|
12
|
+
STDIN.each_line do |line|
|
|
13
|
+
puts line.split[i] rescue ""
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def trim()
|
|
18
|
+
STDIN.each_line do |line|
|
|
19
|
+
puts line.strip
|
|
20
|
+
end
|
|
21
|
+
end
|
|
7
22
|
|
|
8
23
|
def lines()
|
|
9
24
|
if !STDIN.tty?
|
|
@@ -48,14 +63,6 @@ def args(arg1)
|
|
|
48
63
|
end
|
|
49
64
|
end
|
|
50
65
|
|
|
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
66
|
def mul()
|
|
60
67
|
t = STDIN.read_line.to_f64
|
|
61
68
|
|
|
@@ -107,14 +114,6 @@ def abs()
|
|
|
107
114
|
end
|
|
108
115
|
end
|
|
109
116
|
|
|
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
117
|
def exp()
|
|
119
118
|
t = STDIN.read_line.to_f64
|
|
120
119
|
|
|
@@ -138,10 +137,10 @@ end
|
|
|
138
137
|
|
|
139
138
|
def last_nth(arg1)
|
|
140
139
|
end_ = arg1.to_u64
|
|
141
|
-
i = 0u64
|
|
140
|
+
i = 0u64
|
|
142
141
|
t = STDIN.gets_to_end
|
|
143
142
|
if t[-1] == '\n'
|
|
144
|
-
|
|
143
|
+
t = t[0..-2]
|
|
145
144
|
end
|
|
146
145
|
|
|
147
146
|
t.split("\n").reverse_each do |line|
|
|
@@ -160,7 +159,7 @@ def gsubip(arg1, arg2, arg3)
|
|
|
160
159
|
h.print text
|
|
161
160
|
end
|
|
162
161
|
begin
|
|
163
|
-
|
|
162
|
+
File.rename t, arg3
|
|
164
163
|
rescue
|
|
165
164
|
rm t
|
|
166
165
|
end
|
|
@@ -172,7 +171,7 @@ def rip(arg1, arg2, arg3)
|
|
|
172
171
|
h.print text
|
|
173
172
|
end
|
|
174
173
|
begin
|
|
175
|
-
|
|
174
|
+
File.rename t, arg3
|
|
176
175
|
rescue
|
|
177
176
|
rm t
|
|
178
177
|
end
|
|
@@ -194,16 +193,15 @@ def selectlines()
|
|
|
194
193
|
end
|
|
195
194
|
end
|
|
196
195
|
|
|
197
|
-
|
|
198
196
|
def swap(file1, file2)
|
|
199
197
|
[file1, file2].each do |f|
|
|
200
|
-
File.exists?(f) || abort("No file named #{f.dump}"
|
|
198
|
+
File.exists?(f) || abort("No file named #{f.dump}")
|
|
201
199
|
end
|
|
202
200
|
t = File.tempname("coreutils", "_tmp")
|
|
203
201
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
File.rename file1, t
|
|
203
|
+
File.rename file2, file1
|
|
204
|
+
File.rename t, file2
|
|
207
205
|
end
|
|
208
206
|
|
|
209
207
|
def prepend(file)
|
|
@@ -214,7 +212,7 @@ def prepend(file)
|
|
|
214
212
|
end
|
|
215
213
|
|
|
216
214
|
begin
|
|
217
|
-
|
|
215
|
+
File.rename t, file
|
|
218
216
|
rescue
|
|
219
217
|
rm t
|
|
220
218
|
end
|
|
@@ -227,24 +225,13 @@ def append(file)
|
|
|
227
225
|
h << file_data + new_data
|
|
228
226
|
end
|
|
229
227
|
begin
|
|
230
|
-
|
|
228
|
+
File.rename t, file
|
|
231
229
|
rescue
|
|
232
230
|
rm t
|
|
233
231
|
end
|
|
234
232
|
end
|
|
235
233
|
|
|
236
234
|
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
235
|
def self.argument_data(program, usage, long_desc)
|
|
249
236
|
if !(STDOUT.tty?)
|
|
250
237
|
text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
|
|
@@ -252,12 +239,12 @@ class Funcs
|
|
|
252
239
|
text = ""
|
|
253
240
|
end
|
|
254
241
|
|
|
255
|
-
text +=
|
|
242
|
+
text += ("NAME") + "\n\t" + program
|
|
256
243
|
text += " - "
|
|
257
|
-
text += program + "\n" * 2 +
|
|
244
|
+
text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
|
|
258
245
|
# tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
|
|
259
246
|
text += "\t"
|
|
260
|
-
text +=
|
|
247
|
+
text += (program) + " "
|
|
261
248
|
text += usage + "\n\n"
|
|
262
249
|
text += long_desc + "\n\n"
|
|
263
250
|
|
|
@@ -267,12 +254,10 @@ class Funcs
|
|
|
267
254
|
end
|
|
268
255
|
|
|
269
256
|
puts text
|
|
270
|
-
|
|
271
|
-
# puts "</
|
|
272
|
-
# puts "</
|
|
273
257
|
end
|
|
274
258
|
end
|
|
275
259
|
|
|
260
|
+
|
|
276
261
|
def main()
|
|
277
262
|
if ARGV.size != 0
|
|
278
263
|
Funcs.argument_data("abs", "[abs] [arguments]", "Abs gets the absolute value of an integer\n\nThe absolute value of a number is the value of that number without its sign\n\necho -300 | abs\n\n=> 300\n\necho 200 | abs\n\n=> 200 \n\n(echo -2; echo -10) | sub | abs\n\n=> 12\n\nThe last one would do -2 - -10, the result would be -12, and then the absolute value would be computed, and so the result would be 12.")
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/crystal
|
|
2
|
-
require "file_utils"
|
|
3
|
-
require "json"
|
|
4
|
-
require "colorize"
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
def delete(arg)
|
|
4
|
+
`find -name #{arg}`.each_line do |i|
|
|
5
|
+
File.delete(i)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def nth_word(arg)
|
|
11
|
+
i = arg.to_u64 - 1
|
|
12
|
+
STDIN.each_line do |line|
|
|
13
|
+
puts line.split[i] rescue ""
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def trim()
|
|
18
|
+
STDIN.each_line do |line|
|
|
19
|
+
puts line.strip
|
|
20
|
+
end
|
|
21
|
+
end
|
|
7
22
|
|
|
8
23
|
def lines()
|
|
9
24
|
if !STDIN.tty?
|
|
@@ -48,14 +63,6 @@ def args(arg1)
|
|
|
48
63
|
end
|
|
49
64
|
end
|
|
50
65
|
|
|
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
66
|
def mul()
|
|
60
67
|
t = STDIN.read_line.to_f64
|
|
61
68
|
|
|
@@ -107,14 +114,6 @@ def abs()
|
|
|
107
114
|
end
|
|
108
115
|
end
|
|
109
116
|
|
|
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
117
|
def exp()
|
|
119
118
|
t = STDIN.read_line.to_f64
|
|
120
119
|
|
|
@@ -138,10 +137,10 @@ end
|
|
|
138
137
|
|
|
139
138
|
def last_nth(arg1)
|
|
140
139
|
end_ = arg1.to_u64
|
|
141
|
-
i = 0u64
|
|
140
|
+
i = 0u64
|
|
142
141
|
t = STDIN.gets_to_end
|
|
143
142
|
if t[-1] == '\n'
|
|
144
|
-
|
|
143
|
+
t = t[0..-2]
|
|
145
144
|
end
|
|
146
145
|
|
|
147
146
|
t.split("\n").reverse_each do |line|
|
|
@@ -160,7 +159,7 @@ def gsubip(arg1, arg2, arg3)
|
|
|
160
159
|
h.print text
|
|
161
160
|
end
|
|
162
161
|
begin
|
|
163
|
-
|
|
162
|
+
File.rename t, arg3
|
|
164
163
|
rescue
|
|
165
164
|
rm t
|
|
166
165
|
end
|
|
@@ -172,7 +171,7 @@ def rip(arg1, arg2, arg3)
|
|
|
172
171
|
h.print text
|
|
173
172
|
end
|
|
174
173
|
begin
|
|
175
|
-
|
|
174
|
+
File.rename t, arg3
|
|
176
175
|
rescue
|
|
177
176
|
rm t
|
|
178
177
|
end
|
|
@@ -194,16 +193,15 @@ def selectlines()
|
|
|
194
193
|
end
|
|
195
194
|
end
|
|
196
195
|
|
|
197
|
-
|
|
198
196
|
def swap(file1, file2)
|
|
199
197
|
[file1, file2].each do |f|
|
|
200
|
-
File.exists?(f) || abort("No file named #{f.dump}"
|
|
198
|
+
File.exists?(f) || abort("No file named #{f.dump}")
|
|
201
199
|
end
|
|
202
200
|
t = File.tempname("coreutils", "_tmp")
|
|
203
201
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
File.rename file1, t
|
|
203
|
+
File.rename file2, file1
|
|
204
|
+
File.rename t, file2
|
|
207
205
|
end
|
|
208
206
|
|
|
209
207
|
def prepend(file)
|
|
@@ -214,7 +212,7 @@ def prepend(file)
|
|
|
214
212
|
end
|
|
215
213
|
|
|
216
214
|
begin
|
|
217
|
-
|
|
215
|
+
File.rename t, file
|
|
218
216
|
rescue
|
|
219
217
|
rm t
|
|
220
218
|
end
|
|
@@ -227,24 +225,13 @@ def append(file)
|
|
|
227
225
|
h << file_data + new_data
|
|
228
226
|
end
|
|
229
227
|
begin
|
|
230
|
-
|
|
228
|
+
File.rename t, file
|
|
231
229
|
rescue
|
|
232
230
|
rm t
|
|
233
231
|
end
|
|
234
232
|
end
|
|
235
233
|
|
|
236
234
|
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
235
|
def self.argument_data(program, usage, long_desc)
|
|
249
236
|
if !(STDOUT.tty?)
|
|
250
237
|
text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
|
|
@@ -252,12 +239,12 @@ class Funcs
|
|
|
252
239
|
text = ""
|
|
253
240
|
end
|
|
254
241
|
|
|
255
|
-
text +=
|
|
242
|
+
text += ("NAME") + "\n\t" + program
|
|
256
243
|
text += " - "
|
|
257
|
-
text += program + "\n" * 2 +
|
|
244
|
+
text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
|
|
258
245
|
# tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
|
|
259
246
|
text += "\t"
|
|
260
|
-
text +=
|
|
247
|
+
text += (program) + " "
|
|
261
248
|
text += usage + "\n\n"
|
|
262
249
|
text += long_desc + "\n\n"
|
|
263
250
|
|
|
@@ -267,12 +254,10 @@ class Funcs
|
|
|
267
254
|
end
|
|
268
255
|
|
|
269
256
|
puts text
|
|
270
|
-
|
|
271
|
-
# puts "</
|
|
272
|
-
# puts "</
|
|
273
257
|
end
|
|
274
258
|
end
|
|
275
259
|
|
|
260
|
+
|
|
276
261
|
def main()
|
|
277
262
|
if ARGV.size != 0
|
|
278
263
|
Funcs.argument_data("add", "[add] [arguments]", "See the sub example\n\nadd adds integers from the standard input\n\n(echo 1; echo 2; echo 3) | add\n\nThe result would be 6")
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/crystal
|
|
2
|
-
require "file_utils"
|
|
3
|
-
require "json"
|
|
4
|
-
require "colorize"
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
def delete(arg)
|
|
4
|
+
`find -name #{arg}`.each_line do |i|
|
|
5
|
+
File.delete(i)
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def nth_word(arg)
|
|
11
|
+
i = arg.to_u64 - 1
|
|
12
|
+
STDIN.each_line do |line|
|
|
13
|
+
puts line.split[i] rescue ""
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def trim()
|
|
18
|
+
STDIN.each_line do |line|
|
|
19
|
+
puts line.strip
|
|
20
|
+
end
|
|
21
|
+
end
|
|
7
22
|
|
|
8
23
|
def lines()
|
|
9
24
|
if !STDIN.tty?
|
|
@@ -48,14 +63,6 @@ def args(arg1)
|
|
|
48
63
|
end
|
|
49
64
|
end
|
|
50
65
|
|
|
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
66
|
def mul()
|
|
60
67
|
t = STDIN.read_line.to_f64
|
|
61
68
|
|
|
@@ -107,14 +114,6 @@ def abs()
|
|
|
107
114
|
end
|
|
108
115
|
end
|
|
109
116
|
|
|
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
117
|
def exp()
|
|
119
118
|
t = STDIN.read_line.to_f64
|
|
120
119
|
|
|
@@ -138,10 +137,10 @@ end
|
|
|
138
137
|
|
|
139
138
|
def last_nth(arg1)
|
|
140
139
|
end_ = arg1.to_u64
|
|
141
|
-
i = 0u64
|
|
140
|
+
i = 0u64
|
|
142
141
|
t = STDIN.gets_to_end
|
|
143
142
|
if t[-1] == '\n'
|
|
144
|
-
|
|
143
|
+
t = t[0..-2]
|
|
145
144
|
end
|
|
146
145
|
|
|
147
146
|
t.split("\n").reverse_each do |line|
|
|
@@ -160,7 +159,7 @@ def gsubip(arg1, arg2, arg3)
|
|
|
160
159
|
h.print text
|
|
161
160
|
end
|
|
162
161
|
begin
|
|
163
|
-
|
|
162
|
+
File.rename t, arg3
|
|
164
163
|
rescue
|
|
165
164
|
rm t
|
|
166
165
|
end
|
|
@@ -172,7 +171,7 @@ def rip(arg1, arg2, arg3)
|
|
|
172
171
|
h.print text
|
|
173
172
|
end
|
|
174
173
|
begin
|
|
175
|
-
|
|
174
|
+
File.rename t, arg3
|
|
176
175
|
rescue
|
|
177
176
|
rm t
|
|
178
177
|
end
|
|
@@ -194,16 +193,15 @@ def selectlines()
|
|
|
194
193
|
end
|
|
195
194
|
end
|
|
196
195
|
|
|
197
|
-
|
|
198
196
|
def swap(file1, file2)
|
|
199
197
|
[file1, file2].each do |f|
|
|
200
|
-
File.exists?(f) || abort("No file named #{f.dump}"
|
|
198
|
+
File.exists?(f) || abort("No file named #{f.dump}")
|
|
201
199
|
end
|
|
202
200
|
t = File.tempname("coreutils", "_tmp")
|
|
203
201
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
File.rename file1, t
|
|
203
|
+
File.rename file2, file1
|
|
204
|
+
File.rename t, file2
|
|
207
205
|
end
|
|
208
206
|
|
|
209
207
|
def prepend(file)
|
|
@@ -214,7 +212,7 @@ def prepend(file)
|
|
|
214
212
|
end
|
|
215
213
|
|
|
216
214
|
begin
|
|
217
|
-
|
|
215
|
+
File.rename t, file
|
|
218
216
|
rescue
|
|
219
217
|
rm t
|
|
220
218
|
end
|
|
@@ -227,24 +225,13 @@ def append(file)
|
|
|
227
225
|
h << file_data + new_data
|
|
228
226
|
end
|
|
229
227
|
begin
|
|
230
|
-
|
|
228
|
+
File.rename t, file
|
|
231
229
|
rescue
|
|
232
230
|
rm t
|
|
233
231
|
end
|
|
234
232
|
end
|
|
235
233
|
|
|
236
234
|
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
235
|
def self.argument_data(program, usage, long_desc)
|
|
249
236
|
if !(STDOUT.tty?)
|
|
250
237
|
text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
|
|
@@ -252,12 +239,12 @@ class Funcs
|
|
|
252
239
|
text = ""
|
|
253
240
|
end
|
|
254
241
|
|
|
255
|
-
text +=
|
|
242
|
+
text += ("NAME") + "\n\t" + program
|
|
256
243
|
text += " - "
|
|
257
|
-
text += program + "\n" * 2 +
|
|
244
|
+
text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
|
|
258
245
|
# tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
|
|
259
246
|
text += "\t"
|
|
260
|
-
text +=
|
|
247
|
+
text += (program) + " "
|
|
261
248
|
text += usage + "\n\n"
|
|
262
249
|
text += long_desc + "\n\n"
|
|
263
250
|
|
|
@@ -267,12 +254,10 @@ class Funcs
|
|
|
267
254
|
end
|
|
268
255
|
|
|
269
256
|
puts text
|
|
270
|
-
|
|
271
|
-
# puts "</
|
|
272
|
-
# puts "</
|
|
273
257
|
end
|
|
274
258
|
end
|
|
275
259
|
|
|
260
|
+
|
|
276
261
|
def main()
|
|
277
262
|
if ARGV.size != 1
|
|
278
263
|
Funcs.argument_data("append", "[append] [arguments]", "Appends text to file\n\nExample\n\nappend file\n\nThis is more text to be appended")
|