freespeech 1.0.79 → 1.0.87
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/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/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/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/non_compiled_programs/quot +6 -5
- 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
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/crystal
|
|
2
|
-
require "file_utils"
|
|
3
|
-
require "json"
|
|
4
|
-
require "colorize"
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
CORE_UTIL_STRING = "core_utils"
|
|
7
4
|
|
|
8
|
-
def
|
|
5
|
+
def prepend_each(arg)
|
|
6
|
+
STDIN.each_line do |line|
|
|
7
|
+
puts arg + line
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def append_each(arg)
|
|
12
|
+
STDIN.each_line do |line|
|
|
13
|
+
puts line + arg
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def delete(arg)
|
|
18
|
+
`find -name #{arg}`.each_line do |i|
|
|
19
|
+
File.delete(i)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def nth_word(arg)
|
|
24
|
+
i = arg.to_u64 - 1
|
|
25
|
+
STDIN.each_line do |line|
|
|
26
|
+
puts line.split[i] rescue ""
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def trim()
|
|
31
|
+
STDIN.each_line do |line|
|
|
32
|
+
puts line.strip
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def lines(folder = ".")
|
|
9
37
|
if !STDIN.tty?
|
|
10
|
-
puts STDIN.gets_to_end.count(
|
|
38
|
+
puts STDIN.gets_to_end.count('\n')
|
|
11
39
|
else
|
|
12
|
-
res = `find
|
|
40
|
+
res = `find #{folder}`.count('\n') - 1
|
|
13
41
|
puts res
|
|
14
42
|
end
|
|
15
43
|
end
|
|
@@ -48,14 +76,6 @@ def args(arg1)
|
|
|
48
76
|
end
|
|
49
77
|
end
|
|
50
78
|
|
|
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
79
|
def mul()
|
|
60
80
|
t = STDIN.read_line.to_f64
|
|
61
81
|
|
|
@@ -107,14 +127,6 @@ def abs()
|
|
|
107
127
|
end
|
|
108
128
|
end
|
|
109
129
|
|
|
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
130
|
def exp()
|
|
119
131
|
t = STDIN.read_line.to_f64
|
|
120
132
|
|
|
@@ -138,10 +150,10 @@ end
|
|
|
138
150
|
|
|
139
151
|
def last_nth(arg1)
|
|
140
152
|
end_ = arg1.to_u64
|
|
141
|
-
i = 0u64
|
|
153
|
+
i = 0u64
|
|
142
154
|
t = STDIN.gets_to_end
|
|
143
155
|
if t[-1] == '\n'
|
|
144
|
-
|
|
156
|
+
t = t[0..-2]
|
|
145
157
|
end
|
|
146
158
|
|
|
147
159
|
t.split("\n").reverse_each do |line|
|
|
@@ -156,25 +168,25 @@ end
|
|
|
156
168
|
def gsubip(arg1, arg2, arg3)
|
|
157
169
|
regex = Regex.new(arg1)
|
|
158
170
|
text = File.read(arg3).gsub(/#{arg1}/m, arg2)
|
|
159
|
-
File.open(t = File.tempname(
|
|
171
|
+
File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
|
|
160
172
|
h.print text
|
|
161
173
|
end
|
|
162
174
|
begin
|
|
163
|
-
|
|
175
|
+
File.rename t, arg3
|
|
164
176
|
rescue
|
|
165
|
-
|
|
177
|
+
File.delete t
|
|
166
178
|
end
|
|
167
179
|
end
|
|
168
180
|
|
|
169
181
|
def rip(arg1, arg2, arg3)
|
|
170
182
|
text = File.read(arg3).gsub(arg1, arg2)
|
|
171
|
-
File.open(t = File.tempname(
|
|
183
|
+
File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
|
|
172
184
|
h.print text
|
|
173
185
|
end
|
|
174
186
|
begin
|
|
175
|
-
|
|
187
|
+
File.rename t, arg3
|
|
176
188
|
rescue
|
|
177
|
-
|
|
189
|
+
File.delete t
|
|
178
190
|
end
|
|
179
191
|
end
|
|
180
192
|
|
|
@@ -194,57 +206,45 @@ def selectlines()
|
|
|
194
206
|
end
|
|
195
207
|
end
|
|
196
208
|
|
|
197
|
-
|
|
198
209
|
def swap(file1, file2)
|
|
199
210
|
[file1, file2].each do |f|
|
|
200
|
-
File.exists?(f) || abort("No file named #{f.dump}"
|
|
211
|
+
File.exists?(f) || abort("No file named #{f.dump}")
|
|
201
212
|
end
|
|
202
|
-
t = File.tempname(
|
|
213
|
+
t = File.tempname(CORE_UTIL_STRING, "_tmp")
|
|
203
214
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
215
|
+
File.rename file1, t
|
|
216
|
+
File.rename file2, file1
|
|
217
|
+
File.rename t, file2
|
|
207
218
|
end
|
|
208
219
|
|
|
209
220
|
def prepend(file)
|
|
210
221
|
file_data = File.read(file)
|
|
211
222
|
new_data = STDIN.gets_to_end
|
|
212
|
-
File.open(t = File.tempname(
|
|
223
|
+
File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
|
|
213
224
|
h << new_data + file_data
|
|
214
225
|
end
|
|
215
226
|
|
|
216
227
|
begin
|
|
217
|
-
|
|
228
|
+
File.rename t, file
|
|
218
229
|
rescue
|
|
219
|
-
|
|
230
|
+
File.delete t
|
|
220
231
|
end
|
|
221
232
|
end
|
|
222
233
|
|
|
223
234
|
def append(file)
|
|
224
235
|
file_data = File.read(file)
|
|
225
236
|
new_data = STDIN.gets_to_end
|
|
226
|
-
File.open(t = File.tempname(
|
|
237
|
+
File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
|
|
227
238
|
h << file_data + new_data
|
|
228
239
|
end
|
|
229
240
|
begin
|
|
230
|
-
|
|
241
|
+
File.rename t, file
|
|
231
242
|
rescue
|
|
232
|
-
|
|
243
|
+
File.delete t
|
|
233
244
|
end
|
|
234
245
|
end
|
|
235
246
|
|
|
236
247
|
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
248
|
def self.argument_data(program, usage, long_desc)
|
|
249
249
|
if !(STDOUT.tty?)
|
|
250
250
|
text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
|
|
@@ -252,12 +252,12 @@ class Funcs
|
|
|
252
252
|
text = ""
|
|
253
253
|
end
|
|
254
254
|
|
|
255
|
-
text +=
|
|
255
|
+
text += ("NAME") + "\n\t" + program
|
|
256
256
|
text += " - "
|
|
257
|
-
text += program + "\n" * 2 +
|
|
257
|
+
text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
|
|
258
258
|
# tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
|
|
259
259
|
text += "\t"
|
|
260
|
-
text +=
|
|
260
|
+
text += (program) + " "
|
|
261
261
|
text += usage + "\n\n"
|
|
262
262
|
text += long_desc + "\n\n"
|
|
263
263
|
|
|
@@ -267,19 +267,23 @@ class Funcs
|
|
|
267
267
|
end
|
|
268
268
|
|
|
269
269
|
puts text
|
|
270
|
-
|
|
271
|
-
# puts "</
|
|
272
|
-
# puts "</
|
|
273
270
|
end
|
|
274
271
|
end
|
|
275
272
|
|
|
276
|
-
|
|
277
|
-
|
|
273
|
+
|
|
274
|
+
def main
|
|
275
|
+
size = ARGV.size
|
|
276
|
+
|
|
277
|
+
if size != 2
|
|
278
278
|
Funcs.argument_data("swap", "[swap] [arguments]", "Swaps two files\n\nExample\n\nswap text1 text2")
|
|
279
279
|
exit 1
|
|
280
280
|
end
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
begin
|
|
283
|
+
swap(ARGV[0]?, ARGV[1]?)
|
|
284
|
+
rescue e : Exception
|
|
285
|
+
puts e
|
|
286
|
+
end
|
|
283
287
|
end
|
|
284
288
|
|
|
285
289
|
|
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/crystal
|
|
2
|
-
require "file_utils"
|
|
3
|
-
require "json"
|
|
4
|
-
require "colorize"
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
CORE_UTIL_STRING = "core_utils"
|
|
7
4
|
|
|
8
|
-
def
|
|
5
|
+
def prepend_each(arg)
|
|
6
|
+
STDIN.each_line do |line|
|
|
7
|
+
puts arg + line
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def append_each(arg)
|
|
12
|
+
STDIN.each_line do |line|
|
|
13
|
+
puts line + arg
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def delete(arg)
|
|
18
|
+
`find -name #{arg}`.each_line do |i|
|
|
19
|
+
File.delete(i)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def nth_word(arg)
|
|
24
|
+
i = arg.to_u64 - 1
|
|
25
|
+
STDIN.each_line do |line|
|
|
26
|
+
puts line.split[i] rescue ""
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def trim()
|
|
31
|
+
STDIN.each_line do |line|
|
|
32
|
+
puts line.strip
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def lines(folder = ".")
|
|
9
37
|
if !STDIN.tty?
|
|
10
|
-
puts STDIN.gets_to_end.count(
|
|
38
|
+
puts STDIN.gets_to_end.count('\n')
|
|
11
39
|
else
|
|
12
|
-
res = `find
|
|
40
|
+
res = `find #{folder}`.count('\n') - 1
|
|
13
41
|
puts res
|
|
14
42
|
end
|
|
15
43
|
end
|
|
@@ -48,14 +76,6 @@ def args(arg1)
|
|
|
48
76
|
end
|
|
49
77
|
end
|
|
50
78
|
|
|
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
79
|
def mul()
|
|
60
80
|
t = STDIN.read_line.to_f64
|
|
61
81
|
|
|
@@ -107,14 +127,6 @@ def abs()
|
|
|
107
127
|
end
|
|
108
128
|
end
|
|
109
129
|
|
|
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
130
|
def exp()
|
|
119
131
|
t = STDIN.read_line.to_f64
|
|
120
132
|
|
|
@@ -138,10 +150,10 @@ end
|
|
|
138
150
|
|
|
139
151
|
def last_nth(arg1)
|
|
140
152
|
end_ = arg1.to_u64
|
|
141
|
-
i = 0u64
|
|
153
|
+
i = 0u64
|
|
142
154
|
t = STDIN.gets_to_end
|
|
143
155
|
if t[-1] == '\n'
|
|
144
|
-
|
|
156
|
+
t = t[0..-2]
|
|
145
157
|
end
|
|
146
158
|
|
|
147
159
|
t.split("\n").reverse_each do |line|
|
|
@@ -156,25 +168,25 @@ end
|
|
|
156
168
|
def gsubip(arg1, arg2, arg3)
|
|
157
169
|
regex = Regex.new(arg1)
|
|
158
170
|
text = File.read(arg3).gsub(/#{arg1}/m, arg2)
|
|
159
|
-
File.open(t = File.tempname(
|
|
171
|
+
File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
|
|
160
172
|
h.print text
|
|
161
173
|
end
|
|
162
174
|
begin
|
|
163
|
-
|
|
175
|
+
File.rename t, arg3
|
|
164
176
|
rescue
|
|
165
|
-
|
|
177
|
+
File.delete t
|
|
166
178
|
end
|
|
167
179
|
end
|
|
168
180
|
|
|
169
181
|
def rip(arg1, arg2, arg3)
|
|
170
182
|
text = File.read(arg3).gsub(arg1, arg2)
|
|
171
|
-
File.open(t = File.tempname(
|
|
183
|
+
File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(arg3).permissions) do |h|
|
|
172
184
|
h.print text
|
|
173
185
|
end
|
|
174
186
|
begin
|
|
175
|
-
|
|
187
|
+
File.rename t, arg3
|
|
176
188
|
rescue
|
|
177
|
-
|
|
189
|
+
File.delete t
|
|
178
190
|
end
|
|
179
191
|
end
|
|
180
192
|
|
|
@@ -194,57 +206,45 @@ def selectlines()
|
|
|
194
206
|
end
|
|
195
207
|
end
|
|
196
208
|
|
|
197
|
-
|
|
198
209
|
def swap(file1, file2)
|
|
199
210
|
[file1, file2].each do |f|
|
|
200
|
-
File.exists?(f) || abort("No file named #{f.dump}"
|
|
211
|
+
File.exists?(f) || abort("No file named #{f.dump}")
|
|
201
212
|
end
|
|
202
|
-
t = File.tempname(
|
|
213
|
+
t = File.tempname(CORE_UTIL_STRING, "_tmp")
|
|
203
214
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
215
|
+
File.rename file1, t
|
|
216
|
+
File.rename file2, file1
|
|
217
|
+
File.rename t, file2
|
|
207
218
|
end
|
|
208
219
|
|
|
209
220
|
def prepend(file)
|
|
210
221
|
file_data = File.read(file)
|
|
211
222
|
new_data = STDIN.gets_to_end
|
|
212
|
-
File.open(t = File.tempname(
|
|
223
|
+
File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
|
|
213
224
|
h << new_data + file_data
|
|
214
225
|
end
|
|
215
226
|
|
|
216
227
|
begin
|
|
217
|
-
|
|
228
|
+
File.rename t, file
|
|
218
229
|
rescue
|
|
219
|
-
|
|
230
|
+
File.delete t
|
|
220
231
|
end
|
|
221
232
|
end
|
|
222
233
|
|
|
223
234
|
def append(file)
|
|
224
235
|
file_data = File.read(file)
|
|
225
236
|
new_data = STDIN.gets_to_end
|
|
226
|
-
File.open(t = File.tempname(
|
|
237
|
+
File.open(t = File.tempname(CORE_UTIL_STRING, "_tmp"), "w", File.info(file).permissions) do |h|
|
|
227
238
|
h << file_data + new_data
|
|
228
239
|
end
|
|
229
240
|
begin
|
|
230
|
-
|
|
241
|
+
File.rename t, file
|
|
231
242
|
rescue
|
|
232
|
-
|
|
243
|
+
File.delete t
|
|
233
244
|
end
|
|
234
245
|
end
|
|
235
246
|
|
|
236
247
|
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
248
|
def self.argument_data(program, usage, long_desc)
|
|
249
249
|
if !(STDOUT.tty?)
|
|
250
250
|
text = "<div style='border-radius: 50px; border: 10px dotted cyan; padding: 30px;'>\n"
|
|
@@ -252,12 +252,12 @@ class Funcs
|
|
|
252
252
|
text = ""
|
|
253
253
|
end
|
|
254
254
|
|
|
255
|
-
text +=
|
|
255
|
+
text += ("NAME") + "\n\t" + program
|
|
256
256
|
text += " - "
|
|
257
|
-
text += program + "\n" * 2 +
|
|
257
|
+
text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
|
|
258
258
|
# tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
|
|
259
259
|
text += "\t"
|
|
260
|
-
text +=
|
|
260
|
+
text += (program) + " "
|
|
261
261
|
text += usage + "\n\n"
|
|
262
262
|
text += long_desc + "\n\n"
|
|
263
263
|
|
|
@@ -267,19 +267,23 @@ class Funcs
|
|
|
267
267
|
end
|
|
268
268
|
|
|
269
269
|
puts text
|
|
270
|
-
|
|
271
|
-
# puts "</
|
|
272
|
-
# puts "</
|
|
273
270
|
end
|
|
274
271
|
end
|
|
275
272
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
273
|
+
|
|
274
|
+
def main
|
|
275
|
+
size = ARGV.size
|
|
276
|
+
|
|
277
|
+
if size > 0
|
|
278
|
+
Funcs.argument_data("trim", "[trim] [arguments]", "Trims spaces of each line")
|
|
279
279
|
exit 1
|
|
280
280
|
end
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
begin
|
|
283
|
+
trim
|
|
284
|
+
rescue e : Exception
|
|
285
|
+
puts e
|
|
286
|
+
end
|
|
283
287
|
end
|
|
284
288
|
|
|
285
289
|
|
data/src/clock.cr
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
1
|
#!/usr/bin/nohup ac
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
system "killall pulseaudio clock --quiet"
|
|
5
|
+
|
|
6
6
|
class Time_
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
def am?
|
|
8
|
+
return self.hour < 12
|
|
9
|
+
end
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
def pm?
|
|
12
|
+
return !am?
|
|
13
|
+
end
|
|
14
14
|
end
|
|
15
|
+
|
|
15
16
|
l = %w[8 14 0].reverse
|
|
16
17
|
args = ARGV
|
|
17
18
|
if args.size > 0 && args[0] == "stop"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
args = args[1..]
|
|
20
|
+
while true
|
|
21
|
+
system "killall #{PROGRAM_NAME} --quiet -9 >/dev/null 2>/dev/null && (echo Alarm clock stopped | blue)"
|
|
22
|
+
sleep 1
|
|
23
|
+
end
|
|
23
24
|
end
|
|
24
25
|
if args.size < 3
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
def a
|
|
30
|
-
Time.local.hour
|
|
26
|
+
(3 - args.size).times do |i|
|
|
27
|
+
args.push l.pop
|
|
31
28
|
end
|
|
29
|
+
end
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
def a
|
|
32
|
+
Time.local.hour
|
|
33
|
+
end
|
|
36
34
|
|
|
35
|
+
def b
|
|
36
|
+
Time.local.minute
|
|
37
|
+
end
|
|
37
38
|
|
|
38
|
-
#STDOUT.close
|
|
39
|
-
#STDERR.close
|
|
40
|
-
#STDIN.close
|
|
39
|
+
# STDOUT.close
|
|
40
|
+
# STDERR.close
|
|
41
|
+
# STDIN.close
|
|
41
42
|
|
|
42
43
|
32.times do |i|
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
Signal.new(i).trap() do |a|
|
|
45
|
+
end
|
|
45
46
|
end
|
|
46
47
|
Process.fork do
|
|
47
|
-
32.times do |i|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
end
|
|
48
|
+
32.times do |i|
|
|
49
|
+
Signal.new(i).trap() do |a|
|
|
50
|
+
end
|
|
51
|
+
end
|
|
51
52
|
|
|
52
|
-
# args = [
|
|
53
|
+
# args = [
|
|
53
54
|
voices = `flite -lv`.strip.split(": ")[1].split.shuffle.reject { |i| i == "awb_time" }
|
|
54
55
|
100.times do
|
|
55
|
-
# system "xdotool key XF86MonBrightnessDown"
|
|
56
|
+
# system "xdotool key XF86MonBrightnessDown"
|
|
56
57
|
end
|
|
57
58
|
|
|
59
|
+
until a == (args[0].to_i) &&
|
|
60
|
+
b == (args[1].to_i)
|
|
61
|
+
sleep 1
|
|
62
|
+
end
|
|
58
63
|
|
|
59
|
-
until \
|
|
60
|
-
a == (args[0].to_i) &&
|
|
61
|
-
b == (args[1].to_i); sleep 1; end
|
|
62
|
-
|
|
63
64
|
loop do
|
|
64
65
|
now = Time.local
|
|
65
66
|
m = now.to_s
|
|
66
|
-
t = [(((now.hour - 1) % 12) + 1).to_s + ((now.minute.to_s[0] == "0" ?"0" : "") + ":" + now.minute.to_s), "on", m, now.day]
|
|
67
|
-
|
|
67
|
+
t = [(((now.hour - 1) % 12) + 1).to_s + ((now.minute.to_s[0] == "0" ? "0" : "") + ":" + now.minute.to_s), "on", m, now.day]
|
|
68
|
+
# p t
|
|
68
69
|
t = t.join(" ")
|
|
69
70
|
system "echo #{t} | padsp flite -voice #{voices[0]}"
|
|
70
71
|
sleep 1
|
data/src/compile_all
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
cd src 2>/dev/null
|
|
4
4
|
cd src 2>/dev/null
|
|
5
|
-
make || exit 1
|
|
6
5
|
cd ..
|
|
7
6
|
|
|
8
|
-
test -e ../bin/rgsub || (cp -v rgsub ../bin/rgsub || (gcc -O3 -s -Wall -Wextra -fwhole-program rgsub.c -o rgsub && cp -v rgsub ../bin/rgsub
|
|
7
|
+
test -e ../bin/rgsub || (cp -v rgsub ../bin/rgsub || (gcc -O3 -s -Wall -Wextra -fwhole-program rgsub.c -o rgsub && cp -v rgsub ../bin/rgsub))
|
|
9
8
|
CPP=g++
|
|
10
|
-
test -e ../bin/left_right || (cp -v left_right ../bin/left_right || ($CPP -O3 -s -fno-rtti -Wall -Wextra -fwhole-program left_right.cc -o left_right && cp -v left_right ../bin/left_right
|
|
9
|
+
test -e ../bin/left_right || (cp -v left_right ../bin/left_right || ($CPP -s -O3 -s -fno-rtti -Wall -Wextra -fwhole-program left_right.cc -o left_right && cp -v left_right ../bin/left_right))
|
|
11
10
|
CPP=/usr/lib/mxe/usr/bin/x86_64-w64-mingw32.static-g++
|
|
12
|
-
test -e ../bin/left_right.exe || (cp -v left_right.exe ../bin/left_right.exe || ($CPP -std=c++17 -O3 -s -fno-rtti -Wall -Wextra -fwhole-program left_right.cc -o left_right.exe && cp -v left_right.exe ../bin/left_right.exe &&
|
|
11
|
+
test -e ../bin/left_right.exe || (cp -v left_right.exe ../bin/left_right.exe || ($CPP -s -std=c++17 -O3 -s -fno-rtti -Wall -Wextra -fwhole-program left_right.cc -o left_right.exe && cp -v left_right.exe ../bin/left_right.exe && true))
|
|
13
12
|
|
|
14
13
|
echo rgsub
|
|
15
14
|
test -e ../bin/news || (
|
|
@@ -23,17 +22,18 @@ test -e ../bin/clock || (
|
|
|
23
22
|
strip ../bin/clock
|
|
24
23
|
)
|
|
25
24
|
echo clock
|
|
25
|
+
cd src 2>/dev/null
|
|
26
|
+
make || exit 1
|
|
27
|
+
cd ..
|
|
26
28
|
|
|
27
|
-
cd programs
|
|
28
|
-
|
|
29
|
-
for i in *; do
|
|
29
|
+
cd programs && for i in *; do
|
|
30
30
|
|
|
31
31
|
file=../../bin/"$i"
|
|
32
32
|
(/usr/bin/test -e $file && echo ${file} Exist) || (
|
|
33
|
-
echo Need copy
|
|
33
|
+
echo Need a copy
|
|
34
34
|
cp -v "$i" ../../bin/"$i"
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
done
|
|
38
38
|
|
|
39
|
-
cd ..
|
|
39
|
+
cd ..
|
data/src/left_right
CHANGED
|
Binary file
|
data/src/programs/abs
CHANGED
|
Binary file
|
data/src/programs/add
CHANGED
|
Binary file
|
data/src/programs/append
CHANGED
|
Binary file
|
|
Binary file
|
data/src/programs/args
CHANGED
|
Binary file
|
data/src/programs/delete
ADDED
|
Binary file
|
data/src/programs/div
CHANGED
|
Binary file
|
data/src/programs/exp
CHANGED
|
Binary file
|
data/src/programs/floor
CHANGED
|
Binary file
|
data/src/programs/gsub
CHANGED
|
Binary file
|
data/src/programs/gsubip
CHANGED
|
Binary file
|
data/src/programs/last_nth
CHANGED
|
Binary file
|
data/src/programs/lines
CHANGED
|
Binary file
|
data/src/programs/mul
CHANGED
|
Binary file
|
data/src/programs/nth
CHANGED
|
Binary file
|
|
Binary file
|
data/src/programs/prepend
CHANGED
|
Binary file
|
|
Binary file
|
data/src/programs/rip
CHANGED
|
Binary file
|
data/src/programs/rnip
CHANGED
|
Binary file
|
data/src/programs/selectlines
CHANGED
|
Binary file
|
data/src/programs/sub
CHANGED
|
Binary file
|
data/src/programs/swap
CHANGED
|
Binary file
|
data/src/programs/trim
ADDED
|
Binary file
|