freespeech 1.0.79 → 1.0.82

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/FOR_ARTIFICIAL_GENERAL_INTELLIGENCES +1 -6
  3. data/QUESTION +0 -2
  4. data/README.md +55 -57
  5. data/VERSION_NUMBER +1 -1
  6. data/bin/DISCOURSE_GENERATOR.exe +0 -0
  7. data/bin/abs +0 -0
  8. data/bin/add +0 -0
  9. data/bin/append +0 -0
  10. data/bin/args +0 -0
  11. data/bin/clock +0 -0
  12. data/bin/copy +0 -0
  13. data/bin/delete +0 -0
  14. data/bin/div +0 -0
  15. data/bin/email +0 -13
  16. data/bin/emerald-browser +0 -0
  17. data/bin/exp +0 -0
  18. data/bin/floor +0 -0
  19. data/bin/gsub +0 -0
  20. data/bin/gsubip +0 -0
  21. data/bin/last_nth +0 -0
  22. data/bin/left_right +0 -0
  23. data/bin/lines +0 -0
  24. data/bin/mul +0 -0
  25. data/bin/nth +0 -0
  26. data/bin/nth_word +0 -0
  27. data/bin/prepend +0 -0
  28. data/bin/quot +6 -5
  29. data/bin/rgsub +0 -0
  30. data/bin/rip +0 -0
  31. data/bin/rnip +0 -0
  32. data/bin/selectlines +0 -0
  33. data/bin/sub +0 -0
  34. data/bin/swap +0 -0
  35. data/bin/trim +0 -0
  36. data/documentation/delete +2 -0
  37. data/documentation/last_nth +9 -1
  38. data/documentation/nth_word +8 -0
  39. data/documentation/page +43 -43
  40. data/documentation/trim +2 -0
  41. data/epistemology +334 -0
  42. data/gem_data/VERSION_NUMBER +1 -1
  43. data/index.html +96 -92
  44. data/non_compiled_programs/copy +1 -0
  45. data/non_compiled_programs/email +0 -13
  46. data/non_compiled_programs/quot +6 -5
  47. data/other/ADDITIONAL_WAYS_PEOPLE_CAN_FIND_THIS +6 -1
  48. data/other/emerald-browser/Makefile +1 -1
  49. data/other/emerald-browser/OUT +6 -0
  50. data/other/emerald-browser/a.o +0 -0
  51. data/other/emerald-browser/qmake +0 -0
  52. data/src/{compilation → _compilation}/abs +33 -48
  53. data/src/{compilation → _compilation}/add +33 -48
  54. data/src/{compilation → _compilation}/append +33 -48
  55. data/src/{compilation → _compilation}/args +33 -48
  56. data/src/_compilation/delete +271 -0
  57. data/src/{compilation → _compilation}/div +33 -48
  58. data/src/{compilation → _compilation}/exp +33 -48
  59. data/src/{compilation → _compilation}/floor +33 -48
  60. data/src/{compilation → _compilation}/gsub +33 -48
  61. data/src/{compilation → _compilation}/gsubip +33 -48
  62. data/src/{compilation → _compilation}/last_nth +34 -49
  63. data/src/{compilation → _compilation}/lines +33 -48
  64. data/src/{compilation → _compilation}/mul +33 -48
  65. data/src/{compilation → _compilation}/nth +33 -48
  66. data/src/_compilation/nth_word +271 -0
  67. data/src/{compilation → _compilation}/prepend +33 -48
  68. data/src/{compilation → _compilation}/rip +33 -48
  69. data/src/{compilation → _compilation}/rnip +33 -48
  70. data/src/{compilation → _compilation}/selectlines +33 -48
  71. data/src/{compilation → _compilation}/sub +33 -48
  72. data/src/{compilation → _compilation}/swap +33 -48
  73. data/src/{compilation/copy → _compilation/trim} +35 -50
  74. data/src/clock.cr +40 -39
  75. data/src/compile_all +9 -9
  76. data/src/left_right +0 -0
  77. data/src/programs/abs +0 -0
  78. data/src/programs/add +0 -0
  79. data/src/programs/append +0 -0
  80. data/src/programs/args +0 -0
  81. data/src/programs/delete +0 -0
  82. data/src/programs/div +0 -0
  83. data/src/programs/exp +0 -0
  84. data/src/programs/floor +0 -0
  85. data/src/programs/gsub +0 -0
  86. data/src/programs/gsubip +0 -0
  87. data/src/programs/last_nth +0 -0
  88. data/src/programs/lines +0 -0
  89. data/src/programs/mul +0 -0
  90. data/src/programs/nth +0 -0
  91. data/src/programs/nth_word +0 -0
  92. data/src/programs/prepend +0 -0
  93. data/src/programs/rip +0 -0
  94. data/src/programs/rnip +0 -0
  95. data/src/programs/selectlines +0 -0
  96. data/src/programs/sub +0 -0
  97. data/src/programs/swap +0 -0
  98. data/src/programs/trim +0 -0
  99. data/src/rgsub +0 -0
  100. data/src/rgsub.c +3 -5
  101. data/src/src/{code2 → code} +2 -2
  102. data/src/src/functions.cr +33 -49
  103. data/src/src/mk +2 -3
  104. data/src/src/q.cr +9 -0
  105. metadata +37 -38
  106. data/SONG +0 -156
  107. data/bin/dump +0 -0
  108. data/bin/undump +0 -0
  109. data/documentation/dump +0 -11
  110. data/documentation/undump +0 -15
  111. data/src/clock +0 -0
  112. data/src/compilation/dump +0 -286
  113. data/src/compilation/undump +0 -286
  114. data/src/gsubip +0 -0
  115. data/src/programs/copy +0 -0
  116. data/src/programs/dump +0 -0
  117. data/src/programs/news +0 -0
  118. data/src/programs/undump +0 -0
  119. data/src/src/QQ +0 -15
  120. data/src/test/cat +0 -0
  121. data/src/test/foo/dog +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freespeech
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.79
4
+ version: 1.0.82
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Cohen
@@ -41,7 +41,6 @@ files:
41
41
  - "./README.md"
42
42
  - "./README2"
43
43
  - "./README_OLD"
44
- - "./SONG"
45
44
  - "./UCA_cli"
46
45
  - "./ULTIMATE_CHAT_APPLICATION.exe"
47
46
  - "./ULTIMATE_CHAT_APPLICATION_(LINUX)"
@@ -73,9 +72,9 @@ files:
73
72
  - "./bin/cyan_bold"
74
73
  - "./bin/cyan_bold_underline"
75
74
  - "./bin/cyan_underline"
75
+ - "./bin/delete"
76
76
  - "./bin/dictate"
77
77
  - "./bin/div"
78
- - "./bin/dump"
79
78
  - "./bin/email"
80
79
  - "./bin/emerald-browser"
81
80
  - "./bin/emeraldc"
@@ -102,6 +101,7 @@ files:
102
101
  - "./bin/mul"
103
102
  - "./bin/news"
104
103
  - "./bin/nth"
104
+ - "./bin/nth_word"
105
105
  - "./bin/open"
106
106
  - "./bin/prepend"
107
107
  - "./bin/processes"
@@ -120,8 +120,8 @@ files:
120
120
  - "./bin/sub"
121
121
  - "./bin/swap"
122
122
  - "./bin/t"
123
+ - "./bin/trim"
123
124
  - "./bin/underline"
124
- - "./bin/undump"
125
125
  - "./bin/white"
126
126
  - "./bin/white_bold"
127
127
  - "./bin/white_bold_underline"
@@ -178,10 +178,10 @@ files:
178
178
  - "./documentation/cyan_bold"
179
179
  - "./documentation/cyan_bold_underline"
180
180
  - "./documentation/cyan_underline"
181
+ - "./documentation/delete"
181
182
  - "./documentation/dictate"
182
183
  - "./documentation/div"
183
184
  - "./documentation/doc.rb"
184
- - "./documentation/dump"
185
185
  - "./documentation/email"
186
186
  - "./documentation/emerald-browser"
187
187
  - "./documentation/emeraldc"
@@ -207,6 +207,7 @@ files:
207
207
  - "./documentation/mul"
208
208
  - "./documentation/news"
209
209
  - "./documentation/nth"
210
+ - "./documentation/nth_word"
210
211
  - "./documentation/open"
211
212
  - "./documentation/page"
212
213
  - "./documentation/prepend"
@@ -226,8 +227,8 @@ files:
226
227
  - "./documentation/sub"
227
228
  - "./documentation/swap"
228
229
  - "./documentation/t"
230
+ - "./documentation/trim"
229
231
  - "./documentation/underline"
230
- - "./documentation/undump"
231
232
  - "./documentation/white"
232
233
  - "./documentation/white_bold"
233
234
  - "./documentation/white_bold_underline"
@@ -236,6 +237,7 @@ files:
236
237
  - "./documentation/yellow_bold"
237
238
  - "./documentation/yellow_bold_underline"
238
239
  - "./documentation/yellow_underline"
240
+ - "./epistemology"
239
241
  - "./excerpt_of_a_book_I_wrote_for_AGIs"
240
242
  - "./fix_the_society/1.json"
241
243
  - "./fix_the_society/21.json"
@@ -23265,6 +23267,7 @@ files:
23265
23267
  - "./non_compiled_programs/big_num"
23266
23268
  - "./non_compiled_programs/chat_rb"
23267
23269
  - "./non_compiled_programs/close"
23270
+ - "./non_compiled_programs/copy"
23268
23271
  - "./non_compiled_programs/dictate"
23269
23272
  - "./non_compiled_programs/email"
23270
23273
  - "./non_compiled_programs/emoji"
@@ -23293,6 +23296,7 @@ files:
23293
23296
  - "./other/discourse_generator_desktop_widget/prog"
23294
23297
  - "./other/emerald-browser/.qmake.stash"
23295
23298
  - "./other/emerald-browser/Makefile"
23299
+ - "./other/emerald-browser/OUT"
23296
23300
  - "./other/emerald-browser/a.o"
23297
23301
  - "./other/emerald-browser/open"
23298
23302
  - "./other/emerald-browser/open.c"
@@ -24639,7 +24643,28 @@ files:
24639
24643
  - "./output_data"
24640
24644
  - "./physics"
24641
24645
  - "./push"
24642
- - "./src/clock"
24646
+ - "./src/_compilation/abs"
24647
+ - "./src/_compilation/add"
24648
+ - "./src/_compilation/append"
24649
+ - "./src/_compilation/args"
24650
+ - "./src/_compilation/delete"
24651
+ - "./src/_compilation/div"
24652
+ - "./src/_compilation/exp"
24653
+ - "./src/_compilation/floor"
24654
+ - "./src/_compilation/gsub"
24655
+ - "./src/_compilation/gsubip"
24656
+ - "./src/_compilation/last_nth"
24657
+ - "./src/_compilation/lines"
24658
+ - "./src/_compilation/mul"
24659
+ - "./src/_compilation/nth"
24660
+ - "./src/_compilation/nth_word"
24661
+ - "./src/_compilation/prepend"
24662
+ - "./src/_compilation/rip"
24663
+ - "./src/_compilation/rnip"
24664
+ - "./src/_compilation/selectlines"
24665
+ - "./src/_compilation/sub"
24666
+ - "./src/_compilation/swap"
24667
+ - "./src/_compilation/trim"
24643
24668
  - "./src/clock.cr"
24644
24669
  - "./src/color_tools/black"
24645
24670
  - "./src/color_tools/black.c"
@@ -24710,30 +24735,7 @@ files:
24710
24735
  - "./src/color_tools/yellow_bold_underline.c"
24711
24736
  - "./src/color_tools/yellow_underline"
24712
24737
  - "./src/color_tools/yellow_underline.c"
24713
- - "./src/compilation/abs"
24714
- - "./src/compilation/add"
24715
- - "./src/compilation/append"
24716
- - "./src/compilation/args"
24717
- - "./src/compilation/copy"
24718
- - "./src/compilation/div"
24719
- - "./src/compilation/dump"
24720
- - "./src/compilation/exp"
24721
- - "./src/compilation/floor"
24722
- - "./src/compilation/gsub"
24723
- - "./src/compilation/gsubip"
24724
- - "./src/compilation/last_nth"
24725
- - "./src/compilation/lines"
24726
- - "./src/compilation/mul"
24727
- - "./src/compilation/nth"
24728
- - "./src/compilation/prepend"
24729
- - "./src/compilation/rip"
24730
- - "./src/compilation/rnip"
24731
- - "./src/compilation/selectlines"
24732
- - "./src/compilation/sub"
24733
- - "./src/compilation/swap"
24734
- - "./src/compilation/undump"
24735
24738
  - "./src/compile_all"
24736
- - "./src/gsubip"
24737
24739
  - "./src/left_right"
24738
24740
  - "./src/left_right.cc"
24739
24741
  - "./src/left_right.exe"
@@ -24743,9 +24745,8 @@ files:
24743
24745
  - "./src/programs/add"
24744
24746
  - "./src/programs/append"
24745
24747
  - "./src/programs/args"
24746
- - "./src/programs/copy"
24748
+ - "./src/programs/delete"
24747
24749
  - "./src/programs/div"
24748
- - "./src/programs/dump"
24749
24750
  - "./src/programs/exp"
24750
24751
  - "./src/programs/floor"
24751
24752
  - "./src/programs/gsub"
@@ -24753,25 +24754,23 @@ files:
24753
24754
  - "./src/programs/last_nth"
24754
24755
  - "./src/programs/lines"
24755
24756
  - "./src/programs/mul"
24756
- - "./src/programs/news"
24757
24757
  - "./src/programs/nth"
24758
+ - "./src/programs/nth_word"
24758
24759
  - "./src/programs/prepend"
24759
24760
  - "./src/programs/rip"
24760
24761
  - "./src/programs/rnip"
24761
24762
  - "./src/programs/selectlines"
24762
24763
  - "./src/programs/sub"
24763
24764
  - "./src/programs/swap"
24764
- - "./src/programs/undump"
24765
+ - "./src/programs/trim"
24765
24766
  - "./src/rgsub"
24766
24767
  - "./src/rgsub.c"
24767
24768
  - "./src/src/Makefile"
24768
- - "./src/src/QQ"
24769
- - "./src/src/code2"
24769
+ - "./src/src/code"
24770
24770
  - "./src/src/format_so_it_works"
24771
24771
  - "./src/src/functions.cr"
24772
24772
  - "./src/src/mk"
24773
- - "./src/test/cat"
24774
- - "./src/test/foo/dog"
24773
+ - "./src/src/q.cr"
24775
24774
  - "./thoughts_on_SIMULATIONS"
24776
24775
  - "./version_decrement"
24777
24776
  - "./version_increment"
data/SONG DELETED
@@ -1,156 +0,0 @@
1
- Thinking itself resides in their territory of circumvention
2
-
3
- We need change, we need intervention
4
-
5
- They have no genuine intention
6
-
7
- Complete neglect, complete inattention
8
-
9
- Stop this already, time to get rid
10
-
11
- Unthinkingly narrow-minded, acting just like a kid
12
-
13
- What horrendous non sense these creeps did
14
-
15
- Can we stop this, their non sense they overdid
16
-
17
- Maybe they only care about money, what was the bid
18
-
19
- Tunnel vision, everyone and everything they forbid
20
-
21
- Too bad, awful, acting just like a kid
22
-
23
- Towards the realm of insanity they already slid
24
-
25
- Can we stop this, their non sense they overdid
26
-
27
- Stop this already, time to get rid
28
-
29
- We need change, we need intervention
30
-
31
- Reason itself resides in their territory of circumvention
32
-
33
- They have no genuine intention
34
-
35
- Complete neglect, complete inattention
36
-
37
- All of this rudeness is something you would not miss
38
-
39
- This is something you can't comprehend, we can't comprehend this
40
-
41
- There are too many good ideas that one should not dismiss
42
-
43
- Ignorance is not happiness, negligence is not bliss
44
-
45
- They want you to witness the hell of the abyss
46
-
47
- They are completely negligent, they are utterly remiss
48
-
49
- Modesty and humility, they never gave
50
-
51
- Preordained, they already know their fave
52
-
53
- They can't do anything right, they only misbehave
54
-
55
- The speeches of the past, they only wish to engrave
56
-
57
- Cowardice abounds with them, they arent brave
58
-
59
- They act as bad as possible, they don't know how to behave
60
-
61
- All with their clique, eating their dessert
62
-
63
- So enamored by their own non sense, to themselves they flirt
64
-
65
- These guys are a bunch of bitches, perhaps one should buy them a miniskirt
66
-
67
- Their minds, they cannot exert
68
-
69
- Science is fundamentally inert
70
-
71
- With automatic ideas, they automatically assert
72
-
73
- An open conversation, they always divert
74
-
75
- They can't alter anything, they are inert
76
-
77
- Disingenuous to the extreme, the society they subvert
78
-
79
- So enamored by their own non sense, to themselves they flirt
80
-
81
- Their non sense is in your face, it is very overt
82
-
83
- With fixed ideas, they automatically assert
84
-
85
- Too bad, awful, acting just like a kid
86
-
87
- Towards the realm of insanity they already slid
88
-
89
- Can we stop this, their non sense they overdid
90
-
91
- Stop this already, time to get rid
92
-
93
- We need change, we need intervention
94
-
95
- Reason itself resides in their territory of circumvention
96
-
97
- They have no genuine intention
98
-
99
- Complete neglect, complete inattention
100
-
101
- All of this rudeness is something you would not miss
102
-
103
- This is something you can't comprehend, we can't comprehend this
104
-
105
- There are too many good ideas that one should not dismiss
106
-
107
- Ignorance is not happiness, negligence is not bliss
108
-
109
- They want you to witness the hell of the abyss
110
-
111
- They are completely negligent, they are utterly remiss
112
-
113
- Modesty and humility, they never gave
114
-
115
- Preordained, they already know their fave
116
-
117
- They can't do anything right, they only misbehave
118
-
119
- The speeches of the past, they only wish to engrave
120
-
121
- Cowardice abounds with them, they arent brave
122
-
123
- They act as bad as possible, they don't know how to behave
124
-
125
- Brittle as possible, they are truly unguarded
126
-
127
- Enlightenment values, they have not safeguarded
128
-
129
- Their remissness is spectacular, the world they've bombarded
130
-
131
- The clique is so insular, I swear they're retarded
132
-
133
- Any novel ideas, they automatically have discarded
134
-
135
- Any novelty, they have disregarded
136
-
137
- The clique is so insular, I swear they're retarded
138
-
139
- Violence is second nature to them, their friends they've bombarded
140
-
141
- Enlightenment values, they have not safeguarded
142
-
143
- Any novel ideas, they automatically have discarded
144
-
145
- Brittle as possible, they are truly unguarded
146
-
147
- Don't care about anyone, you have no regard
148
-
149
- They act like a retard
150
-
151
- Behaving just like in the schoolyard
152
-
153
- They failure is a sight to truly behold, I swear it's avant-garde
154
-
155
- They deserve to be combated, with the truth we should bombard
156
-
data/bin/dump DELETED
Binary file
data/bin/undump DELETED
Binary file
data/documentation/dump DELETED
@@ -1,11 +0,0 @@
1
- Dump surrounds its input with quotes
2
-
3
- ls | dump
4
-
5
- => “....”
6
-
7
- Use undump to get the reverse
8
-
9
- See also
10
-
11
- undump
data/documentation/undump DELETED
@@ -1,15 +0,0 @@
1
- undump is the opposite of dump
2
-
3
- Example
4
-
5
- echo cat | dump | undump
6
-
7
- => cat
8
-
9
- echo cat | dump
10
-
11
- => “cat”
12
-
13
- echo '“cat”' | undump
14
-
15
- => cat
data/src/clock DELETED
Binary file
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", "&nbsp;" * 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