politics 1.0.87 → 1.0.89

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/ruby
2
+ # This is a work in progress.
3
+
4
+ ROMAN = /^([limcdvx]|[[:punct:]])+$/i
5
+
6
+ def capitalize(a)
7
+ a = a.gsub(/\s*(-|–|—|:)(-|–|—|:)*\s*/, "\\1 ")
8
+ w = a.split
9
+ not_major = /^(?:to|a|an|the|on|in|of|at|and|or|but|nor|for|yet|so)$/i
10
+ w = w.map do |i|
11
+ case i
12
+ when ROMAN
13
+ i.upcase
14
+ when /^(?:not|no|be|is|are|was|were|have|has|had|do|does|did|that|it|my|me|we|our|you|he|his|she|her|they|them|who)$/i
15
+ i.capitalize
16
+ when /(-|–|—|:)/
17
+ i.capitalize
18
+ when not_major
19
+ i.downcase
20
+ else
21
+ i.capitalize
22
+ end
23
+ end
24
+ w = w.to_a
25
+ if w.size == 0
26
+ w = [" "]
27
+ end
28
+ if w[0].match(ROMAN)
29
+ w[0] = w[0].upcase
30
+ else
31
+ w[0] = w[0].capitalize
32
+ end
33
+ if (w[-1].match(ROMAN))
34
+ w[-1] = w[-1].upcase
35
+ else
36
+ w[-1] = w[-1].capitalize
37
+ end
38
+ w = w.join(" ")
39
+ w = w.gsub "- ", "-"
40
+ w
41
+ end
42
+
43
+
44
+ print (capitalize ARGV.join(" "))
@@ -2,6 +2,14 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  PROG1 = %w[htmlbeautifier clang-format][1]
5
+ puts PROG1
6
+ print "OK ? "
7
+ response = ""
8
+ response = STDIN.readline.strip while response.empty?
9
+ if response.match /[nN]/
10
+ abort
11
+ end
12
+
5
13
  PROG2 = "rufo"
6
14
 
7
15
  require "tempfile"
data/other/communicate ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: false
3
+
4
+ # BSD 2-Clause License
5
+ #
6
+ # Copyright (c) 2023, Gregory Cohen
7
+ # All rights reserved.
8
+ #
9
+ # Redistribution and use in source and binary forms, with or without
10
+ # modification, are permitted provided that the following conditions are met:
11
+ #
12
+ # 1. Redistributions of source code must retain the above copyright notice, this
13
+ # list of conditions and the following disclaimer.
14
+ #
15
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
16
+ # this list of conditions and the following disclaimer in the documentation
17
+ # and/or other materials provided with the distribution.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+ require 'colored'
30
+
31
+ str = 'Enter '
32
+
33
+ $old_str = ''
34
+ def puts__(str, ack = false)
35
+ # def puts.old_str
36
+ return unless ENV['C_CODE'].nil?
37
+ # if ENV["C_CODE
38
+ # if
39
+ # requi
40
+ return if $old_str == str
41
+
42
+ str = str.to_s
43
+ def str.colorify
44
+ bold.send ''.colors.sample
45
+ end
46
+
47
+ def str.ack
48
+ ['Thank you. '][0]
49
+ end
50
+
51
+ str.prepend str.ack if ack == true
52
+ print "#{str.colorify}\n"
53
+
54
+ system "echo '#{str}' | flite -voice slt "
55
+ end
56
+
57
+ alias :say puts__
58
+
59
+ count = 0
60
+ # speak str
61
+
62
+ def $stdin.readline
63
+ Dir.chdir Dir.home
64
+ Dir.chdir 'nerd-dictation'
65
+ res = ''
66
+ while res.strip == ''
67
+ res = %x(
68
+ ./nerd-dictation begin --vosk-model-dir=`printf "%s\n" ./vosk-model-small-en-us* | head -n 1` --timeout 1.0 2>&1 --output STDOUT)
69
+
70
+ res = '' if res.downcase.include?('no text')
71
+ # STDOUT.print res
72
+ end
73
+ res
74
+ end
75
+
76
+ loop do
77
+ puts__ ARGV[0], ack = false
78
+ $text = $stdin.readline
79
+
80
+ class Object
81
+ def eval(*_args)
82
+ text = $text
83
+ Kernel.eval to_s
84
+ end
85
+ end
86
+
87
+ ARGV[1..-1].map(&:eval)
88
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: politics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.87
4
+ version: 1.0.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Cohen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-16 00:00:00.000000000 Z
11
+ date: 2023-06-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |+
14
14
  Trying to help with democracy. (No affiliation with politics.)
@@ -69,6 +69,7 @@ files:
69
69
  - "./bin/clock"
70
70
  - "./bin/close"
71
71
  - "./bin/copy"
72
+ - "./bin/ctit"
72
73
  - "./bin/cyan"
73
74
  - "./bin/cyan_bold"
74
75
  - "./bin/cyan_bold_underline"
@@ -176,6 +177,7 @@ files:
176
177
  - "./documentation/clock"
177
178
  - "./documentation/close"
178
179
  - "./documentation/copy"
180
+ - "./documentation/ctit"
179
181
  - "./documentation/cyan"
180
182
  - "./documentation/cyan_bold"
181
183
  - "./documentation/cyan_bold_underline"
@@ -23271,6 +23273,7 @@ files:
23271
23273
  - "./non_compiled_programs/chat_rb"
23272
23274
  - "./non_compiled_programs/close"
23273
23275
  - "./non_compiled_programs/copy"
23276
+ - "./non_compiled_programs/ctit"
23274
23277
  - "./non_compiled_programs/dictate"
23275
23278
  - "./non_compiled_programs/email"
23276
23279
  - "./non_compiled_programs/emoji"
@@ -23291,6 +23294,7 @@ files:
23291
23294
  - "./other/best_programming_language/example.c"
23292
23295
  - "./other/best_programming_language/out_0.c"
23293
23296
  - "./other/cleanup"
23297
+ - "./other/communicate"
23294
23298
  - "./other/democracy.gemspec"
23295
23299
  - "./other/discourse_generator_desktop_widget/.qmake.stash"
23296
23300
  - "./other/discourse_generator_desktop_widget/a.cpp"