politics 1.0.81 → 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.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/CYCLE_OF_HEALTH +9 -15
  3. data/FOR_ARTIFICIAL_GENERAL_INTELLIGENCES +1 -6
  4. data/Makefile +1 -1
  5. data/QUESTION +0 -2
  6. data/README.md +89 -79
  7. data/VERSION_NUMBER +1 -1
  8. data/bin/DISCOURSE_GENERATOR.exe +0 -0
  9. data/bin/abs +0 -0
  10. data/bin/add +0 -0
  11. data/bin/append +0 -0
  12. data/bin/append_each +0 -0
  13. data/bin/args +0 -0
  14. data/bin/clock +0 -0
  15. data/bin/copy +0 -0
  16. data/bin/delete +0 -0
  17. data/bin/div +0 -0
  18. data/bin/email +0 -13
  19. data/bin/emerald-browser +0 -0
  20. data/bin/exp +0 -0
  21. data/bin/floor +0 -0
  22. data/bin/google_speak +4 -3
  23. data/bin/gsub +0 -0
  24. data/bin/gsubip +0 -0
  25. data/bin/last_nth +0 -0
  26. data/bin/left_right +0 -0
  27. data/bin/lines +0 -0
  28. data/bin/mul +0 -0
  29. data/bin/nth +0 -0
  30. data/bin/nth_word +0 -0
  31. data/bin/prepend +0 -0
  32. data/bin/prepend_each +0 -0
  33. data/bin/rgsub +0 -0
  34. data/bin/rip +0 -0
  35. data/bin/rnip +0 -0
  36. data/bin/selectlines +0 -0
  37. data/bin/sub +0 -0
  38. data/bin/swap +0 -0
  39. data/bin/trim +0 -0
  40. data/documentation/append_each +3 -0
  41. data/documentation/delete +2 -0
  42. data/documentation/last_nth +9 -1
  43. data/documentation/left_right.exe +1 -1
  44. data/documentation/nth_word +8 -0
  45. data/documentation/page +12 -11
  46. data/documentation/prepend_each +3 -0
  47. data/documentation/trim +2 -0
  48. data/epistemology +334 -0
  49. data/gem_data/VERSION_NUMBER +1 -1
  50. data/index.html +70 -58
  51. data/install.sh +5 -1
  52. data/non_compiled_programs/copy +1 -0
  53. data/non_compiled_programs/email +0 -13
  54. data/non_compiled_programs/google_speak +4 -3
  55. data/other/ADDITIONAL_WAYS_PEOPLE_CAN_FIND_THIS +6 -1
  56. data/{cleanup → other/cleanup} +1 -0
  57. data/other/emerald-browser/Makefile +1 -1
  58. data/other/emerald-browser/OUT +6 -0
  59. data/other/emerald-browser/a.o +0 -0
  60. data/other/emerald-browser/qmake +0 -0
  61. data/other/experimental_code/ABOUT_S +1 -10
  62. data/other/experimental_code/a/six +0 -0
  63. data/other/experimental_code/odi +4 -10
  64. data/other/experimental_code/orig +11 -20
  65. data/other/experimental_code/pr.rb +1 -1
  66. data/src/{compilation → _compilation}/abs +67 -63
  67. data/src/{compilation → _compilation}/add +67 -63
  68. data/src/{compilation → _compilation}/append +67 -63
  69. data/src/_compilation/append_each +290 -0
  70. data/src/{compilation → _compilation}/args +67 -63
  71. data/src/_compilation/delete +290 -0
  72. data/src/{compilation → _compilation}/div +67 -63
  73. data/src/{compilation → _compilation}/exp +67 -63
  74. data/src/{compilation → _compilation}/floor +67 -63
  75. data/src/{compilation → _compilation}/gsub +67 -63
  76. data/src/{compilation → _compilation}/gsubip +67 -63
  77. data/src/{compilation → _compilation}/last_nth +68 -64
  78. data/src/{compilation → _compilation}/lines +67 -63
  79. data/src/{compilation → _compilation}/mul +67 -63
  80. data/src/{compilation → _compilation}/nth +67 -63
  81. data/src/_compilation/nth_word +290 -0
  82. data/src/{compilation → _compilation}/prepend +67 -63
  83. data/src/_compilation/prepend_each +290 -0
  84. data/src/{compilation → _compilation}/rip +67 -63
  85. data/src/{compilation → _compilation}/rnip +67 -63
  86. data/src/{compilation → _compilation}/selectlines +67 -63
  87. data/src/{compilation → _compilation}/sub +67 -63
  88. data/src/{compilation → _compilation}/swap +67 -63
  89. data/src/{compilation/copy → _compilation/trim} +68 -64
  90. data/src/clock.cr +40 -39
  91. data/src/compile_all +9 -9
  92. data/src/left_right +0 -0
  93. data/src/programs/abs +0 -0
  94. data/src/programs/add +0 -0
  95. data/src/programs/append +0 -0
  96. data/src/programs/append_each +0 -0
  97. data/src/programs/args +0 -0
  98. data/src/programs/delete +0 -0
  99. data/src/programs/div +0 -0
  100. data/src/programs/exp +0 -0
  101. data/src/programs/floor +0 -0
  102. data/src/programs/gsub +0 -0
  103. data/src/programs/gsubip +0 -0
  104. data/src/programs/last_nth +0 -0
  105. data/src/programs/lines +0 -0
  106. data/src/programs/mul +0 -0
  107. data/src/programs/nth +0 -0
  108. data/src/programs/nth_word +0 -0
  109. data/src/programs/prepend +0 -0
  110. data/src/programs/prepend_each +0 -0
  111. data/src/programs/rip +0 -0
  112. data/src/programs/rnip +0 -0
  113. data/src/programs/selectlines +0 -0
  114. data/src/programs/sub +0 -0
  115. data/src/programs/swap +0 -0
  116. data/src/programs/trim +0 -0
  117. data/src/rgsub +0 -0
  118. data/src/rgsub.c +25 -28
  119. data/src/src/Makefile +1 -1
  120. data/src/src/cd +3 -0
  121. data/src/src/{code2 → code} +32 -11
  122. data/src/src/functions.cr +58 -61
  123. data/src/src/mk +8 -11
  124. data/src/src/rm +1 -0
  125. metadata +51 -46
  126. data/SONG +0 -156
  127. data/bin/dump +0 -0
  128. data/bin/undump +0 -0
  129. data/documentation/dump +0 -11
  130. data/documentation/undump +0 -15
  131. data/other/experimental_code/a/a.out +0 -0
  132. data/other/experimental_code/a/hello_world +0 -0
  133. data/other/experimental_code/c_program_faster +0 -0
  134. data/src/clock +0 -0
  135. data/src/compilation/dump +0 -286
  136. data/src/compilation/undump +0 -286
  137. data/src/gsubip +0 -0
  138. data/src/programs/copy +0 -0
  139. data/src/programs/dump +0 -0
  140. data/src/programs/news +0 -0
  141. data/src/programs/undump +0 -0
  142. data/src/src/QQ +0 -15
  143. data/src/test/cat +0 -0
  144. data/src/test/foo/dog +0 -0
  145. /data/images/{12.png → 8.png} +0 -0
  146. /data/other/experimental_code/{Resume.pdf → description_of_what_ive_done_old.pdf} +0 -0
  147. /data/other/experimental_code/{merge → merge.rb} +0 -0
data/install.sh CHANGED
@@ -16,7 +16,11 @@ else
16
16
  clobber=
17
17
  fi
18
18
 
19
- read -p "Enter path besides /usr/bin to install (or leave blank) " var
19
+ if [[ "$1" =~ "y" ]]; then
20
+ var=
21
+ else
22
+ read -p "Enter path besides /usr/bin to install (or leave blank) " var
23
+ fi
20
24
 
21
25
  test -z || mkdir -p "$var"
22
26
 
@@ -0,0 +1 @@
1
+ xclip -selection c
@@ -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'
@@ -1,3 +1,4 @@
1
- #!/bin/bash
2
- say() { local IFS=+;/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=$*&tl=en"; }
3
- say $* &>/dev/null
1
+ #!/bin/sh
2
+ IFS=+
3
+
4
+ mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=$*&tl=en" 2>/dev/null 1>/dev/null
@@ -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
@@ -1,5 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
+ cd ..
3
4
  set -e
4
5
  set -x
5
6
  export GIT_ASKPASS="$HOME/commit"
@@ -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)
@@ -0,0 +1,6 @@
1
+ new_list.append(0)
2
+ f.setPointSize(20)
3
+ view.setFont(f)
4
+ f.setStyleStrategy(QFont::PreferAntialias)
5
+ layout.setOrientation(Qt::Vertical)
6
+ layout.addWidget(consoleptr)
Binary file
Binary file
@@ -1,18 +1,9 @@
1
1
  This is the entire stock history for the entire toronto stock exchange
2
2
 
3
-
4
-
5
3
  This information is given out very publically from many different sources and websites.
6
4
 
7
-
8
-
9
5
  Use this information for any purpose within reason.
10
6
 
11
-
12
-
13
7
  I do not condone or support any illegal activity.
14
8
 
15
-
16
- If I should or need to remove this from this repository, then please contact me and I can do so.
17
-
18
-
9
+ If I should or need to remove this from this repository, then please contact me and I can do so.
Binary file
@@ -1,12 +1,6 @@
1
1
  cd
2
2
 
3
-
4
- for i in Desktop/*; do gio set -t string "$i" metadata::caja-icon-position 00,00 ; caja -q &>/dev/null; done
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
3
+ for i in Desktop/*; do
4
+ gio set -t string "$i" metadata::caja-icon-position 00,00
5
+ caja -q &>/dev/null
6
+ done
@@ -1,14 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
-
4
- a= ('a' .. 'z').to_a
5
- a += ('A' .. 'Z').to_a
6
- a += (0 .. 9).to_a
7
- foo = (((0..199).to_a.map do |i|
8
- a.sample.to_s
3
+ a = ("a".."z").to_a
4
+ a += ("A".."Z").to_a
5
+ a += (0..9).to_a
6
+ foo = (((0..199).to_a.map do |i|
7
+ a.sample.to_s
9
8
  end).join)
10
9
 
11
- main_text = <<EOF
10
+ main_text = <<EOF
12
11
  From: <gregorycohenvideos@gmail.com>
13
12
  To: gregorycohenvideos@gmail.com
14
13
  MIME-Version: 1.0
@@ -19,15 +18,11 @@ Content-Type: text/plain; charset=utf-8
19
18
  Content-Transfer-Encoding: 7bit\n\nMessage\n
20
19
  EOF
21
20
 
22
-
23
21
  for arg in ARGV; file_text = File.read arg
24
- if file_text == foo
25
- raise
22
+ if file_text == foo
23
+ raise
26
24
  end
27
-
28
-
29
-
30
- main_text += <<EOF
25
+ main_text += <<EOF
31
26
 
32
27
  --#{foo}
33
28
  Content-Disposition: attachment; filename="#{arg}"
@@ -35,15 +30,11 @@ Content-Type: text/plain
35
30
 
36
31
  #{file_text}
37
32
 
38
- EOF
39
-
40
-
41
- end
33
+ EOF end
42
34
 
43
35
  main_text += "--#{foo}--"
44
36
  puts main_text
45
37
 
46
38
  IO.popen("himalaya send", "w") do |f|
47
- f.print main_text.gsub("\n", "\r\n")
39
+ f.print main_text.gsub("\n", "\r\n")
48
40
  end
49
-
@@ -1,5 +1,5 @@
1
1
  # !/usr/bin/ruby
2
- b = Dir.glob '*' # 0
2
+ b = Dir.glob "*" # 0
3
3
 
4
4
  def out(*a)
5
5
  print a.join(" ")
@@ -1,15 +1,43 @@
1
1
  #!/usr/bin/crystal
2
- require "file_utils"
3
- require "json"
4
- require "colorize"
5
2
 
6
- include FileUtils
3
+ CORE_UTIL_STRING = "core_utils"
7
4
 
8
- def lines()
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("\n")
38
+ puts STDIN.gets_to_end.count('\n')
11
39
  else
12
- res = `find .`.count("\n") - 1
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
- t = t[0..-2]
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("coreutils", "_tmp"), "w", File.info(arg3).permissions) do |h|
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
- mv t, arg3
175
+ File.rename t, arg3
164
176
  rescue
165
- rm t
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("coreutils", "_tmp"), "w", File.info(arg3).permissions) do |h|
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
- mv t, arg3
187
+ File.rename t, arg3
176
188
  rescue
177
- rm t
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}".colorize(:red))
211
+ File.exists?(f) || abort("No file named #{f.dump}")
201
212
  end
202
- t = File.tempname("coreutils", "_tmp")
213
+ t = File.tempname(CORE_UTIL_STRING, "_tmp")
203
214
 
204
- mv file1, t
205
- mv file2, file1
206
- mv t, file2
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("coreutils", "_tmp"), "w", File.info(file).permissions) do |h|
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
- mv t, file
228
+ File.rename t, file
218
229
  rescue
219
- rm t
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("coreutils", "_tmp"), "w", File.info(file).permissions) do |h|
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
- mv t, file
241
+ File.rename t, file
231
242
  rescue
232
- rm t
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 += bold("NAME") + "\n\t" + program
255
+ text += ("NAME") + "\n\t" + program
256
256
  text += " - "
257
- text += program + "\n" * 2 + bold("SYNOPSIS") + "\n"
257
+ text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
258
258
  # tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
259
259
  text += "\t"
260
- text += bold(program) + " "
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
- def main()
277
- if ARGV.size != 0
273
+
274
+ def main
275
+ size = ARGV.size
276
+
277
+ if size > 0
278
278
  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.")
279
279
  exit 1
280
280
  end
281
281
 
282
- abs
282
+ begin
283
+ abs
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
- include FileUtils
3
+ CORE_UTIL_STRING = "core_utils"
7
4
 
8
- def lines()
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("\n")
38
+ puts STDIN.gets_to_end.count('\n')
11
39
  else
12
- res = `find .`.count("\n") - 1
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
- t = t[0..-2]
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("coreutils", "_tmp"), "w", File.info(arg3).permissions) do |h|
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
- mv t, arg3
175
+ File.rename t, arg3
164
176
  rescue
165
- rm t
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("coreutils", "_tmp"), "w", File.info(arg3).permissions) do |h|
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
- mv t, arg3
187
+ File.rename t, arg3
176
188
  rescue
177
- rm t
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}".colorize(:red))
211
+ File.exists?(f) || abort("No file named #{f.dump}")
201
212
  end
202
- t = File.tempname("coreutils", "_tmp")
213
+ t = File.tempname(CORE_UTIL_STRING, "_tmp")
203
214
 
204
- mv file1, t
205
- mv file2, file1
206
- mv t, file2
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("coreutils", "_tmp"), "w", File.info(file).permissions) do |h|
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
- mv t, file
228
+ File.rename t, file
218
229
  rescue
219
- rm t
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("coreutils", "_tmp"), "w", File.info(file).permissions) do |h|
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
- mv t, file
241
+ File.rename t, file
231
242
  rescue
232
- rm t
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 += bold("NAME") + "\n\t" + program
255
+ text += ("NAME") + "\n\t" + program
256
256
  text += " - "
257
- text += program + "\n" * 2 + bold("SYNOPSIS") + "\n"
257
+ text += program + "\n" * 2 + ("SYNOPSIS") + "\n"
258
258
  # tebold_("SYNOPSIS_")# + bold("SYNOPSIS")
259
259
  text += "\t"
260
- text += bold(program) + " "
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
- def main()
277
- if ARGV.size != 0
273
+
274
+ def main
275
+ size = ARGV.size
276
+
277
+ if size > 0
278
278
  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")
279
279
  exit 1
280
280
  end
281
281
 
282
- add
282
+ begin
283
+ add
284
+ rescue e : Exception
285
+ puts e
286
+ end
283
287
  end
284
288
 
285
289