politics 1.0.91 → 1.0.94

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +62 -51
  3. data/VERSION_NUMBER +1 -1
  4. data/bin/autocorrect +312 -0
  5. data/bin/black +0 -0
  6. data/bin/black_bold +0 -0
  7. data/bin/black_bold_underline +0 -0
  8. data/bin/black_underline +0 -0
  9. data/bin/blue +0 -0
  10. data/bin/blue_bold +0 -0
  11. data/bin/blue_bold_underline +0 -0
  12. data/bin/blue_underline +0 -0
  13. data/bin/bold +0 -0
  14. data/bin/cyan +0 -0
  15. data/bin/cyan_bold +0 -0
  16. data/bin/cyan_bold_underline +0 -0
  17. data/bin/cyan_underline +0 -0
  18. data/bin/green +0 -0
  19. data/bin/green_bold +0 -0
  20. data/bin/green_bold_underline +0 -0
  21. data/bin/green_underline +0 -0
  22. data/bin/magenta +0 -0
  23. data/bin/magenta_bold +0 -0
  24. data/bin/magenta_bold_underline +0 -0
  25. data/bin/magenta_underline +0 -0
  26. data/bin/red +0 -0
  27. data/bin/red_bold +0 -0
  28. data/bin/red_bold_underline +0 -0
  29. data/bin/red_underline +0 -0
  30. data/bin/underline +0 -0
  31. data/bin/white +0 -0
  32. data/bin/white_bold +0 -0
  33. data/bin/white_bold_underline +0 -0
  34. data/bin/white_underline +0 -0
  35. data/bin/yellow +0 -0
  36. data/bin/yellow_bold +0 -0
  37. data/bin/yellow_bold_underline +0 -0
  38. data/bin/yellow_underline +0 -0
  39. data/documentation/autocorrect +3 -0
  40. data/documentation/ctit +12 -1
  41. data/documentation/email +2 -2
  42. data/documentation/left_right.exe +4 -3
  43. data/gem_data/VERSION_NUMBER +1 -1
  44. data/gem_data/push_snap +30 -0
  45. data/images/Store.png +0 -0
  46. data/index.html +60 -57
  47. data/non_compiled_programs/autocorrect +312 -0
  48. data/push_snap +30 -0
  49. data/src/color_tools/black +0 -0
  50. data/src/color_tools/black.c +9 -12
  51. data/src/color_tools/black_bold +0 -0
  52. data/src/color_tools/black_bold.c +9 -12
  53. data/src/color_tools/black_bold_underline +0 -0
  54. data/src/color_tools/black_bold_underline.c +9 -12
  55. data/src/color_tools/black_underline +0 -0
  56. data/src/color_tools/black_underline.c +9 -12
  57. data/src/color_tools/blue +0 -0
  58. data/src/color_tools/blue.c +9 -12
  59. data/src/color_tools/blue_bold +0 -0
  60. data/src/color_tools/blue_bold.c +9 -12
  61. data/src/color_tools/blue_bold_underline +0 -0
  62. data/src/color_tools/blue_bold_underline.c +9 -12
  63. data/src/color_tools/blue_underline +0 -0
  64. data/src/color_tools/blue_underline.c +9 -12
  65. data/src/color_tools/bold +0 -0
  66. data/src/color_tools/bold.c +9 -12
  67. data/src/color_tools/colors.rb +9 -12
  68. data/src/color_tools/cyan +0 -0
  69. data/src/color_tools/cyan.c +9 -12
  70. data/src/color_tools/cyan_bold +0 -0
  71. data/src/color_tools/cyan_bold.c +9 -12
  72. data/src/color_tools/cyan_bold_underline +0 -0
  73. data/src/color_tools/cyan_bold_underline.c +9 -12
  74. data/src/color_tools/cyan_underline +0 -0
  75. data/src/color_tools/cyan_underline.c +9 -12
  76. data/src/color_tools/green +0 -0
  77. data/src/color_tools/green.c +9 -12
  78. data/src/color_tools/green_bold +0 -0
  79. data/src/color_tools/green_bold.c +9 -12
  80. data/src/color_tools/green_bold_underline +0 -0
  81. data/src/color_tools/green_bold_underline.c +9 -12
  82. data/src/color_tools/green_underline +0 -0
  83. data/src/color_tools/green_underline.c +9 -12
  84. data/src/color_tools/magenta +0 -0
  85. data/src/color_tools/magenta.c +9 -12
  86. data/src/color_tools/magenta_bold +0 -0
  87. data/src/color_tools/magenta_bold.c +9 -12
  88. data/src/color_tools/magenta_bold_underline +0 -0
  89. data/src/color_tools/magenta_bold_underline.c +9 -12
  90. data/src/color_tools/magenta_underline +0 -0
  91. data/src/color_tools/magenta_underline.c +9 -12
  92. data/src/color_tools/red +0 -0
  93. data/src/color_tools/red.c +9 -12
  94. data/src/color_tools/red_bold +0 -0
  95. data/src/color_tools/red_bold.c +9 -12
  96. data/src/color_tools/red_bold_underline +0 -0
  97. data/src/color_tools/red_bold_underline.c +9 -12
  98. data/src/color_tools/red_underline +0 -0
  99. data/src/color_tools/red_underline.c +9 -12
  100. data/src/color_tools/underline +0 -0
  101. data/src/color_tools/underline.c +9 -12
  102. data/src/color_tools/white +0 -0
  103. data/src/color_tools/white.c +9 -12
  104. data/src/color_tools/white_bold +0 -0
  105. data/src/color_tools/white_bold.c +9 -12
  106. data/src/color_tools/white_bold_underline +0 -0
  107. data/src/color_tools/white_bold_underline.c +9 -12
  108. data/src/color_tools/white_underline +0 -0
  109. data/src/color_tools/white_underline.c +9 -12
  110. data/src/color_tools/yellow +0 -0
  111. data/src/color_tools/yellow.c +9 -12
  112. data/src/color_tools/yellow_bold +0 -0
  113. data/src/color_tools/yellow_bold.c +9 -12
  114. data/src/color_tools/yellow_bold_underline +0 -0
  115. data/src/color_tools/yellow_bold_underline.c +9 -12
  116. data/src/color_tools/yellow_underline +0 -0
  117. data/src/color_tools/yellow_underline.c +9 -12
  118. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5be0ca4baacad9d794548b297c4f66d018ff818db60553c16ceabe630407248f
4
- data.tar.gz: 4dab2bd927903fa39a74eb12ac13d5d43c87d263b66a3d4710dd2c9406a8da7a
3
+ metadata.gz: 33b2ae2fa0148b8eb6b1eb12d3c802a304c1e516f02f23d31d44992e893a9240
4
+ data.tar.gz: a8e3e4f038ecf754cef5b51e2863f146f10368fadf5a12e4dfac14d0b274b45f
5
5
  SHA512:
6
- metadata.gz: bb116f93d4fe0e5d50f88ddbc70111678908d4a4356171375bcd12271c644d396053988238b9c9ec96380b3c2f93a57b3613a7e1fe84d886523c8388523b475a
7
- data.tar.gz: ea329bd05f1f2fe9b3716d100d7d16f6fff8ce977cf436dc54f51372ab21fbfda2e5c3542769f167aed325743dffb74720079ca879d4d19c8c740238da760a2d
6
+ metadata.gz: 73ffe59b5103d65e390a7cddddafb22452022507384134370ac4520698fa61696a97b0b83411b21bae0c28715bbaf6d6cbfa3c5f0f89af77f8df9d0d60ca1586
7
+ data.tar.gz: 51a056c61fae58bf56147c6cf4b13b0bf49a527ed237a8375b882e4fc9ef2e31681c4a903460be94a7041e20c8542fe3495cf975cfe292447c9419e4dded634b
data/README.md CHANGED
@@ -31,7 +31,7 @@ I intend to make people more able.
31
31
  I was working on a “to buy” program regarding stocks, but it only
32
32
  partly works right now and it's not as useful as the other software.
33
33
  The find housing tool actually helped me to find housing in real life.
34
- Those aside, there are these 87 programs.
34
+ Those aside, there are these 88 programs.
35
35
  Some ones that convert text are skipped in this documentation because
36
36
  their name and usage is obvious (e.g., color tools).
37
37
 
@@ -109,7 +109,7 @@ You can use them anywhere without dependencies.
109
109
 
110
110
  Democracy Github Ruby Gem Python PIP Package
111
111
 
112
- Without further ado, here are the 87 documented programs. (The obvious usage
112
+ Without further ado, here are the 88 documented programs. (The obvious usage
113
113
  ones are omitted.)
114
114
 
115
115
  ### 1. Ultimate Chat Application.exe
@@ -184,10 +184,10 @@ ones are omitted.)
184
184
 
185
185
  This is a tool to bring sanity to politics.
186
186
  ![UCA](./images/8.png)
187
- It gets viewpoints from the person that see the good in each political
188
- side, left, right, left, right, etc.
189
- It then presents all of that.
190
- Hopefully this can make people more sane and less hyper-partisan.
187
+ It asks for viewpints from a person that see the good things in each
188
+ political side--left, right, left, right, etc.
189
+ It then makes a webpage of that and presents all of that.
190
+ Hopefully this can make people more sane, and less hyper-partisan.
191
191
  ### 5. Find Housing
192
192
 
193
193
  This is a nice tool to find housing with.
@@ -217,7 +217,12 @@ ones are omitted.)
217
217
  (echo 2; echo; echo; echo) | selectlines
218
218
  => 2
219
219
  The result would be 2, with no blank lines after that
220
- ### 10. Processes
220
+ ### 10. Autocorrect
221
+
222
+ Command line offline non-AI free software BSD licensed autocorrect
223
+ using words file.
224
+ Work in progress.
225
+ ### 11. Processes
221
226
 
222
227
  Processes lists all processes with a certain name
223
228
  For example
@@ -225,7 +230,7 @@ ones are omitted.)
225
230
  processes bash
226
231
  processes ruby
227
232
  processes gsub
228
- ### 11. Emeraldc
233
+ ### 12. Emeraldc
229
234
 
230
235
  The Ultimate C Preprocessor
231
236
  I'm naming this preprocessor “Emerald C.”
@@ -357,32 +362,32 @@ ones are omitted.)
357
362
  sys 0m0.160s
358
363
  Rust takes 0.637 seconds to compile an empty file!
359
364
  That is not ideal.
360
- ### 12. Nth Word
365
+ ### 13. Nth Word
361
366
 
362
367
  nth_word gets the nth word of each line
363
368
  For example
364
369
  nth_word 3
365
370
  gets the 3rd word of each line
366
- ### 13. Last Nth
371
+ ### 14. Last Nth
367
372
 
368
373
  Last nth gets the last n lines from input
369
374
  For example
370
375
  last_nth 3
371
376
  Would get the 3rd from the last line
372
- ### 14. Speakcat
377
+ ### 15. Speakcat
373
378
 
374
379
  Speak cat is a tool like “cat,” which shows the content of files
375
380
  (technically, it combines the content of files).
376
381
  But speak cat also speaks the text.
377
382
  Which could be useful in some circumstances.
378
383
  It's kind of like “tee” to your ear.
379
- ### 15. UCA CLI
384
+ ### 16. UCA CLI
380
385
 
381
386
  CLI for uca app
382
- ### 16. Big Num
387
+ ### 17. Big Num
383
388
 
384
389
  ![UCA](./images/10.png)
385
- ### 17. Squeeze
390
+ ### 18. Squeeze
386
391
 
387
392
  Squeeze reads all input from stdin, then it prints it back omitting
388
393
  argument 1 line from the front, and argument 2 lines from the back
@@ -392,20 +397,20 @@ ones are omitted.)
392
397
  squeeze 5 3
393
398
  This would omit the first 5 lines and the last 3 lines
394
399
  squeeze 2 2 [file] also works, it outputs text to file
395
- ### 18. Dictate
400
+ ### 19. Dictate
396
401
 
397
402
  Dictate opens web pages in emerald browser, or in any browser
398
403
  (depending on the environment variable set), by you speaking, instead
399
404
  of typing.
400
405
  There is a mode called c_mode, that allows you to make code from
401
406
  speaking.
402
- ### 19. Prepend
407
+ ### 20. Prepend
403
408
 
404
409
  prepend prepends input taken from the standard input to a file
405
410
  Usage
406
411
  prepend [file]
407
412
  This is text to be prepended
408
- ### 20. Chat Rb
413
+ ### 21. Chat Rb
409
414
 
410
415
  This program is excellent.
411
416
  It's essentially a mix of ChatGPT and a shell, such as bash or ZSH.
@@ -414,16 +419,16 @@ ones are omitted.)
414
419
  It outputs chatgpt data to an output folder in home folder and copies
415
420
  it to clipboard
416
421
  To run a shell command, prefix things with “c,” such as c gcc.....
417
- ### 21. Append
422
+ ### 22. Append
418
423
 
419
424
  Appends text to file
420
425
  Example
421
426
  append file
422
427
  This is more text to be appended
423
- ### 22. Delete
428
+ ### 23. Delete
424
429
 
425
430
  Recursively delete all files named a certain name.
426
- ### 23. Gsubip
431
+ ### 24. Gsubip
427
432
 
428
433
  Global Substitute (Gsub) In Place
429
434
  gsubip is like gsub, which replaces all instances of a regular
@@ -440,7 +445,7 @@ ones are omitted.)
440
445
  It takes exactly 3 arguments, no more, no fewer.
441
446
  See also
442
447
  gsub
443
- ### 24. Rhyme
448
+ ### 25. Rhyme
444
449
 
445
450
  A very powerful music generator program that doesn't use AI.
446
451
  See this channel as an example of potential usage of this public
@@ -621,7 +626,7 @@ ones are omitted.)
621
626
  Disingenuous to the extreme, the society they subvert
622
627
  The society is the ones who hurt
623
628
  ---
624
- ### 25. Email
629
+ ### 26. Email
625
630
 
626
631
  This currently doesn't work for gmail since 2022 due to policy changes.
627
632
  A simple and practical tool to email people using Himalaya
@@ -629,17 +634,17 @@ ones are omitted.)
629
634
  You would need to configure the script by changing its source code.
630
635
  Modes
631
636
  email [no arguments]
632
- Email [yourself]
637
+ email [yourself]
633
638
  email [addr]
634
- Email one email address
639
+ email one email address
635
640
  email [Subject] [addr] [option more addrs]
636
641
  Example
637
642
  email 'Gregory, I love your software!' gregorycohenvideos@gmail.com
638
643
  my_friend@outlook.com person@example.com
639
- ### 26. Floor
644
+ ### 27. Floor
640
645
 
641
646
  Gets the floor of numbers e.g. 21.3 -> 21
642
- ### 27. Rgsub
647
+ ### 28. Rgsub
643
648
 
644
649
  Recursively replaces text.
645
650
  Verbosely tells you everything that happens.
@@ -657,11 +662,11 @@ ones are omitted.)
657
662
  -v, verbose mode
658
663
  -- Indicate end of options.
659
664
 
660
- ### 28. Lines
665
+ ### 29. Lines
661
666
 
662
667
  Lines gets the number of files in the current folder that you are in.
663
668
  It can also act like “wc -l” if you pipe data into it.
664
- ### 29. Clock
669
+ ### 30. Clock
665
670
 
666
671
  clock is useful
667
672
  clock is a command line alarm clock
@@ -678,14 +683,14 @@ ones are omitted.)
678
683
  To stop it
679
684
  Run this command
680
685
  clock stop
681
- ### 30. Emoji
686
+ ### 31. Emoji
682
687
 
683
688
  Emoji converts words to emojis from the standard input
684
689
  It can also speak the output
685
690
  It can also copy the output to your clipboard
686
691
  It is very useful
687
692
  ![UCA](./images/6.png)
688
- ### 31. Close
693
+ ### 32. Close
689
694
 
690
695
  “Close” is a simple program that closes “Emerald Browser,” a new web
691
696
  browser based on the same engine as Chrome. Currently, Emerald Browser
@@ -719,17 +724,22 @@ ones are omitted.)
719
724
  some people.
720
725
  Currently, content, like YouTube videos, can't be made fullscreen.
721
726
  If anyone wants to contribute, feel free to!
722
- ### 32. Copy
727
+ ### 33. Copy
723
728
 
724
729
  copy copies the standard input
725
730
  Example
726
731
  ls | copy
727
- ### 33. Ctit
732
+ ### 34. Ctit
728
733
 
729
734
  Capitalize Title
730
735
  A work in progress.
731
- Capitalizes the input and treats it like a title.
732
- ### 34. Gsub
736
+ Capitalizes arguments and treats them like a title.
737
+ ctit this is my heading
738
+ ==> This Is My Heading for a Document
739
+ You can also do
740
+ ctit .... | copy
741
+ To copy the title to your clipboard
742
+ ### 35. Gsub
733
743
 
734
744
  Gsub is very powerful.
735
745
  Usage
@@ -738,7 +748,7 @@ ones are omitted.)
738
748
  cat text | gsub man dog
739
749
  cat text | gsub 'man|boy|cat|dog' food
740
750
  ls | gsub Desktop cat
741
- ### 35. News
751
+ ### 36. News
742
752
 
743
753
  Gets the news from bbc
744
754
  Usage
@@ -746,14 +756,14 @@ ones are omitted.)
746
756
  news speak
747
757
  uses google_speak to SPEAK the news, one story at a time.
748
758
  ![UCA](./images/5.png)
749
- ### 36. Args
759
+ ### 37. Args
750
760
 
751
761
  args is like a better xargs
752
762
  args works properly with spaces in the name of commands
753
763
  It takes exactly one argument
754
764
  Example
755
765
  ls | args “mv -t ../f”
756
- ### 37. Rnip
766
+ ### 38. Rnip
757
767
 
758
768
  Replace Not In Place
759
769
  This is like gsub, but for strings, not for regular expressions
@@ -761,10 +771,10 @@ ones are omitted.)
761
771
  echo .......... | rnip foo bar
762
772
  See also
763
773
  gsub
764
- ### 38. Trim
774
+ ### 39. Trim
765
775
 
766
776
  Trims spaces of each line
767
- ### 39. Quot
777
+ ### 40. Quot
768
778
 
769
779
  Turns quotes in text into good text and makes text presentable.
770
780
  Example
@@ -775,7 +785,7 @@ ones are omitted.)
775
785
  Example 3
776
786
  (Quote the file and output it)
777
787
  quot text_file
778
- ### 40. Open
788
+ ### 41. Open
779
789
 
780
790
  “open” is a very efficient program that searches a query from google,
781
791
  and then opens it in Emerald Browser.
@@ -796,25 +806,25 @@ ones are omitted.)
796
806
  See also
797
807
  emerald-browser
798
808
  close
799
- ### 41. Swap
809
+ ### 42. Swap
800
810
 
801
811
  Swaps two files
802
812
  Example
803
813
  swap text1 text2
804
- ### 42. Exp
814
+ ### 43. Exp
805
815
 
806
816
  exp is an exponentiation tool
807
817
  (echo 5; echo 3) | exp
808
818
  => 125
809
819
  (echo 2; echo 10) | exp
810
820
  => 1024
811
- ### 43. Div
821
+ ### 44. Div
812
822
 
813
823
  Divides numbers
814
824
  Example
815
825
  (echo 5000; echo 100) | div
816
826
  => 50
817
- ### 44. Mul
827
+ ### 45. Mul
818
828
 
819
829
  Multiply numbers
820
830
  echo 1 > file
@@ -824,10 +834,10 @@ ones are omitted.)
824
834
  echo 5 >> file
825
835
  cat file | mul
826
836
  => 120
827
- ### 45. Nth
837
+ ### 46. Nth
828
838
 
829
839
  Nth gets the nth line from the input
830
- ### 46. Abs
840
+ ### 47. Abs
831
841
 
832
842
  Abs gets the absolute value of an integer
833
843
  The absolute value of a number is the value of that number without its
@@ -840,13 +850,13 @@ ones are omitted.)
840
850
  => 12
841
851
  The last one would do -2 - -10, the result would be -12, and then the
842
852
  absolute value would be computed, and so the result would be 12.
843
- ### 47. Add
853
+ ### 48. Add
844
854
 
845
855
  See the sub example
846
856
  add adds integers from the standard input
847
857
  (echo 1; echo 2; echo 3) | add
848
858
  The result would be 6
849
- ### 48. Sub
859
+ ### 49. Sub
850
860
 
851
861
  Sub is a simple command line program that subtracts integers.
852
862
  For some reason, no simple program did this.
@@ -863,14 +873,14 @@ ones are omitted.)
863
873
  (echo 5; echo 2) | sub
864
874
  Result =>
865
875
  3
866
- ### 49. Rip
876
+ ### 50. Rip
867
877
 
868
878
  Replace In Place
869
879
  rip tool replaces a string, not a regular expression, with another
870
880
  string
871
881
  Example
872
882
  rip cat dog file
873
- ### 50. G+
883
+ ### 51. G+
874
884
 
875
885
  A compiler for C += 2. If you want to use C++ with Python syntax, you
876
886
  can use this.
@@ -878,7 +888,7 @@ ones are omitted.)
878
888
  Example
879
889
  g+ a.cpp -o out
880
890
  See also README file & emerald-browser and its source
881
- ### 51. T
891
+ ### 52. T
882
892
 
883
893
  “t” is incredibly useful.
884
894
  It can be used many, many times every day by computer power users.
@@ -925,6 +935,7 @@ Navigation
925
935
  Google Speak
926
936
  Append Each
927
937
  Selectlines
938
+ Autocorrect
928
939
  Processes
929
940
  Emeraldc
930
941
  Nth Word
data/VERSION_NUMBER CHANGED
@@ -1 +1 @@
1
- 91.0
1
+ 94.0
data/bin/autocorrect ADDED
@@ -0,0 +1,312 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # frozen_string_literal: false
4
+ SPECIAL = {"cmd" => "command", "unix" => "UNIX"}
5
+
6
+ print "\rAUTOCORRECT\r\n"
7
+ require 'set'
8
+ $ln = Set.new File.read("/usr/share/dict/words").split
9
+ exc = %w[coo verb cad Mar Mao ma Mai Mae wag wan T's Th wad cab mad strep pi goo fob foe yo yon fog fop war i ] # '
10
+
11
+ exc.each do |i|
12
+ raise "No #{i}" unless $ln.include?(i)
13
+ end
14
+
15
+ $ln -= exc
16
+
17
+ LINES = "\n" << $ln.sort.reverse.join("\n") << "\n"
18
+
19
+ AMOUNT = 1
20
+ PUNCT = (("!".."@")).map do |i|
21
+ i.chr
22
+ end.reject do |i|
23
+ ("0".."9").include? i
24
+ end
25
+
26
+ #puts PUNCT.to_a.to_s
27
+
28
+ def get_word_(word)
29
+ return word if $ln.include? word
30
+ return word if $ln.include? word.downcase
31
+ return word.capitalize if $ln.include? word.capitalize
32
+
33
+ special = SPECIAL[word]
34
+ if special; return special; end
35
+
36
+ c = word.chars
37
+
38
+ i = c.size
39
+
40
+ def get(c, i)
41
+ return "" if c.size.zero?
42
+ while i != 0
43
+ c.permutation(i).each do |q|
44
+ # if q == first_len
45
+ # i-=1
46
+ # next
47
+ # end
48
+ q = q.join
49
+ len = LINES.scan(reg = /\n#{q}[^\n]*/i).map do |i|
50
+ i[1..-1]
51
+ end.sort do |a, b|
52
+ if a[0].downcase? == b[0].downcase?
53
+ a <=> b
54
+ else
55
+ b <=> a
56
+ end
57
+ end
58
+ # puts (len.reject do |i| i.size != 3; end.to_a.to_s)
59
+
60
+ # warn "\n#{q}[^\n]".inspect[1..-2].prepend('/').concat('/')
61
+ # warn format('permutation of %s chars of %s len of %s', i, q, len.inspect)
62
+ # return len
63
+ next if len.empty?
64
+
65
+ char_size = c.size
66
+ # puts char_size, len[0].size, len.to_s
67
+ # sleep
68
+ # puts len.inspect
69
+
70
+ len.each do |i|
71
+ cur_siz = i.size
72
+ # puts [i, c].to_s
73
+ next if cur_siz < char_size
74
+ next if cur_siz > char_size + AMOUNT
75
+
76
+ funcs = []
77
+ q.chars.each do |i|
78
+ funcs << if ("A".."Z").cover? i
79
+ :upcase
80
+ else
81
+ :downcase
82
+ end
83
+ end
84
+
85
+ funcs.size.times do |q|
86
+ i[q] = i[q].send funcs[q]
87
+ end
88
+ return i
89
+ end
90
+ end
91
+
92
+ i -= 1
93
+ end
94
+
95
+ "ERROR text is #{c.join.inspect}"
96
+ end
97
+
98
+ if i > 4
99
+ max = 0
100
+ l = $ln
101
+ maxes = {}
102
+
103
+ j = c.join
104
+
105
+ # puts 55
106
+
107
+ (c.size - c.size).times do |n|
108
+ n += 1
109
+ cont = 0
110
+ while cont < c.size
111
+ first = j[0..cont - 1]
112
+ second = j[cont..cont + n - 1].upcase.clear
113
+ third = j[n + cont..-1]
114
+ unless third
115
+ cont += 1
116
+ next
117
+ end
118
+ first = "" if cont.zero?
119
+
120
+ puts first + second + third
121
+ cont += 1
122
+ end
123
+
124
+ puts "DONE"
125
+ end
126
+ # puts 'DO'
127
+
128
+ l.each_with_index do |a, _index|
129
+ count = 0
130
+ orig_a = a.dup
131
+ a = a.dup
132
+
133
+ c.each do |char|
134
+ if a.include? char
135
+ count += 1
136
+ a.sub! char, ""
137
+ end
138
+ end
139
+
140
+ next unless count >= max && count != 0
141
+
142
+ # puts [count, max].to_s
143
+ maxes[orig_a] = count
144
+ max = count
145
+ end
146
+
147
+ maxes.select! do |_k, v|
148
+ v == max
149
+ end
150
+
151
+ l.each do |i_|
152
+ next if i_.size < c.size
153
+
154
+ maxes[i_] = max if i_[0..3] == c.join[0..3]
155
+ end
156
+ #puts l.size
157
+ def foo(a, b, c)
158
+ p = 0
159
+ while p < c.size && p < a.size
160
+ break if c[p] != a[p]
161
+
162
+ p += 1
163
+ end
164
+ p2 = 0
165
+ while p2 < c.size && p2 < b.size
166
+ break if c[p2] != b[p2]
167
+
168
+ p2 += 1
169
+ end
170
+
171
+ [p, p2]
172
+ end
173
+
174
+ val = maxes.keys.sort do |a, b|
175
+ p, p2 = foo(a, b, c)
176
+
177
+ if p2 - p >= 1
178
+ 1
179
+ elsif p2 == p2
180
+ 0
181
+ elsif p2 - p <= 1
182
+ -1
183
+ end
184
+ end[0..20].sort_by(&:size)[0..10].sort do |a, b|
185
+ p, p2 = foo(a, b, c)
186
+
187
+ if p2 - p >= 1
188
+ 1
189
+ elsif p2 == p2
190
+ 0
191
+ elsif p2 - p <= 1
192
+ -1
193
+ end
194
+ end[0]
195
+
196
+ raise unless val.class == String
197
+
198
+ return val
199
+ else
200
+ get(c, i)
201
+ end
202
+ end
203
+
204
+ require "io/console"
205
+
206
+ class String
207
+ def end?
208
+ self == "\r" || self == "\n" || self == "\t"
209
+ end
210
+
211
+ def downcase?
212
+ !!match(/[a-z]/)
213
+ end
214
+ end
215
+
216
+ class DoneException < Exception
217
+ end
218
+
219
+ def _get
220
+ a = nil
221
+ $c = ""
222
+ while a != " "
223
+ a = $stdin.getc
224
+ #print a.inspect
225
+ raise DoneException.new if a == "\x03"
226
+ if a == "\u007F"
227
+ $all_text = $all_text[0..-2]
228
+ $c = $c[0..-2]
229
+ print "\e[1D \e[1D"
230
+ next
231
+ end
232
+ $c << a
233
+ $all_text << a
234
+ putc(a) unless a.end?
235
+ return nil if a.end?
236
+ end
237
+
238
+ $c.chomp! " "
239
+ # $c.gsub!(/\e\[[A-Z]/, "")
240
+
241
+ # print c.inspect
242
+
243
+ File.open("words", "a") do |f|
244
+ f.puts c.inspect
245
+ end if false
246
+ c = $c
247
+
248
+ $c = ""
249
+ c
250
+ end
251
+
252
+ str = ""
253
+ $all_text = ""
254
+
255
+ $stdin.tty? && $stdin.raw do
256
+ last_char = "."
257
+ loop do
258
+ qi = _get
259
+ i=qi&.gsub(/\e\[[A-Z]/, "")
260
+
261
+
262
+ if i.nil?
263
+ print "\r\n"
264
+ next
265
+ end
266
+ if i.empty?
267
+ # print ' '
268
+ next
269
+ end
270
+
271
+ # raise if / |\e/.match?(i)
272
+
273
+ new_word = get_word_(i.sub(/[[:punct:]]+/, "")) + i.match(/[[:punct:]]+$/ ).to_s; if PUNCT.include?(last_char); new_word[0]=new_word[0].upcase; end
274
+ puts new_word.inspect if false
275
+
276
+ amount = i.size + 1
277
+ f = File.open("words", "a") if false
278
+
279
+ # if amount == 0
280
+ #
281
+ # text = ""/
282
+ #else
283
+ if new_word == i
284
+ else
285
+ print "\e[#{amount}D" << new_word << " "
286
+ end
287
+
288
+ $all_text = $all_text[0..-(1 + i.size + " ".size)]
289
+ $all_text << new_word << " "
290
+ last_char = new_word[-1]
291
+ # end
292
+
293
+ # puts new_word.inspect
294
+
295
+ #print "\u001b[0K"
296
+
297
+ #{new_word} "
298
+ end
299
+ rescue DoneException
300
+ end #rescue DoneException
301
+
302
+
303
+ #$all_text << $c
304
+ #system 'tput reset'
305
+ at=nil
306
+
307
+ #puts "\n\nYour story\n\n"
308
+ IO.popen("xclip -selection c", 'w') do |i|
309
+ i.print at=$all_text.strip
310
+ end
311
+ puts "YOUR STORY COPIED"
312
+ print at
data/bin/black CHANGED
Binary file
data/bin/black_bold CHANGED
Binary file
Binary file
data/bin/black_underline CHANGED
Binary file
data/bin/blue CHANGED
Binary file
data/bin/blue_bold CHANGED
Binary file