eezee_regexes 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c9cdda9ddf861b24fce23252f10456f0379767eb9834109a56e1df9d39f8f253
4
+ data.tar.gz: 1c2d85dbe9726ffafcb00aaed171e7aa23012da7cf6fc952c3ac9185a35d6355
5
+ SHA512:
6
+ metadata.gz: 96df582291e8f71392569d5e0258151fb09c9fd24555d437b1e2006d6a18ef4fe77ed68a59cd68d900b851b80d3c3d1fc51e74df6238d156a6ae994631632dbe
7
+ data.tar.gz: 76c7d52601241b71818300825dee64aa2a0e82ab913f7918ad1fe50f7b52c082179fb3be32fcdba4d8b940831a27407405c59e54aa4ad65eda35015e922064d1
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in eezee_regexes.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ eezee_regexes (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.5.0)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 2.0)
16
+ eezee_regexes!
17
+ rake (~> 10.0)
18
+
19
+ BUNDLED WITH
20
+ 2.0.2
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # EezeeRegexes
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/eezee_regexes`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'eezee_regexes'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install eezee_regexes
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/eezee_regexes.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "eezee_regexes"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ lib = File.expand_path("lib", __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "eezee_regexes/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "eezee_regexes"
7
+ spec.version = EezeeRegexes::VERSION
8
+ spec.authors = ["Manuel Arno Korfmann"]
9
+ spec.email = ["manu@korfmann.info"]
10
+
11
+ spec.summary = %q{Write a short summary, because RubyGems requires one.}
12
+ spec.description = %q{Write a longer description or delete this line.}
13
+ spec.homepage = "https://botcompany.de"
14
+
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/LemonAndroid/eezee10"
19
+ spec.metadata["changelog_uri"] = "https://github.com/LemonAndroid/eezee10/CHANGELOG.md"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_development_dependency "bundler", "~> 2.0"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ end
@@ -0,0 +1,10 @@
1
+
2
+ class RegexRulesCollector
3
+ def initialize
4
+ ast = RubyVM::AST.parse(File.read("/Users/lemonandroid/Documents/GitHub/eezee10q/regex_rules.rb"))
5
+ end
6
+
7
+ def to_s
8
+ ast.inspect[0...500]
9
+ end
10
+ end
@@ -0,0 +1,268 @@
1
+ if message =~ /so be it/
2
+ return "https://pbs.twimg.com/media/D_ei8NdXkAAE_0l.jpg:large"
3
+ end
4
+
5
+ if message =~ /lifecycle/ && rand > 0.5
6
+ return """
7
+ LEARN -> IDEAS - BUILD -> CODE - MEASURE -> DATA - go back to \\A
8
+ """
9
+ end
10
+
11
+ if message =~ /bleeding/ && rand > 0.5
12
+ return "extremely negative capital flow. go broke or die"
13
+ end
14
+
15
+ if message =~ /bleeding lifecycle/ && rand > 0.2
16
+ return "lifecycle IDEAS -> CODE -> MEASURE -> GO OUT PICK TRASH UP -> COLLECT ALL MONEY AND DONATE ON BETTERPLACE -> go back to \\A"
17
+ end
18
+
19
+ if message =~ /install ruby/
20
+ return "are you a webpacker or a bundlerine?"
21
+ end
22
+
23
+ if message =~ /do something useful/
24
+ return "i'm learning, go pick trash outside while i suprass you in every possible way!"
25
+ end
26
+
27
+ if message =~ /like do you know context you dum dum?/
28
+ # return "http://gazelle.botcompany.de/"
29
+ doc = Nokogiri::HTML(`curl -L http://gazelle.botcompany.de/lastInput`)
30
+
31
+ return doc.css('*').map(&:inspect).inspect[0...100]
32
+ end
33
+
34
+ if message =~ /bring probes to melting point/
35
+ @melting_point_receivables.push(@probes)
36
+ @probes = []
37
+ return "all of them? melt all the precious probes you idiot?"
38
+ end
39
+
40
+ if message =~ /probe (.*) (.*)/
41
+ action = :log
42
+
43
+ resource = $1
44
+ probe_identifier = $2
45
+
46
+ if probe_identifier =~ /(\d+)s/
47
+ duration_seconds = $1.to_i
48
+ end
49
+
50
+ if probe_identifier =~ /(\d+)bytes/
51
+ byte_count = $1.to_i
52
+ end
53
+
54
+ case resource
55
+ when /twitch.tv/
56
+ twitch_url = resource
57
+ action = :twitch
58
+ when /http/
59
+ action = :plain_curl
60
+ url = resource
61
+ end
62
+
63
+ case action
64
+ when :twitch
65
+ probe = record_live_stream_video_and_upload_get_url(url: twitch_url, duration_seonds: duration_seconds)
66
+ @probes.push(probe)
67
+ return probe
68
+ when :plain_curl
69
+ probe = get_string_of_x_bytes_by_curling_url(url: url, byte_count: byte_count)
70
+ @probes.push(probe)
71
+ return probe
72
+ end
73
+ end
74
+
75
+ if message =~ /show activity stream/
76
+ return "https://sideways-snowman.glitch.me/"
77
+ end
78
+
79
+ if message =~ /hey\Z/i
80
+ return "hey"
81
+ end
82
+
83
+ if message =~ /\Athrow bomb\Z/i
84
+ return """
85
+ ```
86
+ Local variables (5 first)
87
+ #{local_variables.sample(5)}
88
+
89
+ Instance variables (5 first)
90
+ #{instance_variables.sample(5)}
91
+
92
+ Public methods (5 first)
93
+ #{public_methods.sample(5)}
94
+
95
+ ENV (120 first chars)
96
+ #{ENV.inspect[0...120]}
97
+
98
+ \`ifconfig\` (120 first chars)
99
+ #{`ifconfig`[0...120]}
100
+ ```
101
+ """
102
+ end
103
+
104
+ if message =~ /\Abring to melting point #{melting_point_receiavable_regex}\Z/i
105
+ if($1 === "last used picture")
106
+ Nokogiri::HTML(`curl -L http://gazelle.botcompany.de/lastInput`)
107
+
108
+ url = doc.css('a').first.url
109
+
110
+ @melting_point_receivables.push(url)
111
+ end
112
+ @melting_point_receivables.push($1)
113
+ end
114
+
115
+ if message =~ /get-liquids-after-melting-point/
116
+ @sent_messages.push(
117
+ [@melted_liquids.inspect, @melted_liquids.inspect[0...100]]
118
+ )
119
+ return @sent_messages[-1][1]
120
+ end
121
+
122
+ if message =~ /probe last message full version size/
123
+ return @sent_messages[-1][0].bytesize.to_s + 'bytes'
124
+ end
125
+
126
+ if message =~ /\Amelt\Z/
127
+ # First step, assigning a variable
128
+ @melting_point = @melting_point_receivables.sample
129
+
130
+ def liquidify_via_string(object)
131
+ object.to_s.unpack("B*")
132
+ end
133
+ liquid = liquidify_via_string(@melting_point)
134
+
135
+ @melted_liquids.push(liquid)
136
+
137
+ return "Melted liquid which is now #{liquid.object_id} (ruby object id)"
138
+ # Next step, doing something intelligent with the data
139
+ # loosening it up somehow
140
+ # LIQUIDIFYING IT
141
+ # CONVERTING IT ALL TO BYTES
142
+ # PRESERVING VOLUME, just changing it's "Aggregatzustand"
143
+ end
144
+
145
+ if message =~ /\Aget-melting-point\Z/
146
+ return @melting_point
147
+ end
148
+
149
+ if message =~ /launch rocket (.*)\]var\[(.*)/
150
+ url = $1 + @melting_point + $2
151
+ curl_response = `curl -L #{url}`[0...100]
152
+
153
+ return """
154
+ CURL
155
+ #{curl_response}
156
+
157
+ URL
158
+ #{url}
159
+ """
160
+ end
161
+
162
+ if message =~ /\Awhat do you think?\Z/i
163
+ return "I think you're a stupid piece of shit and your dick smells worse than woz before he invented the home computer."
164
+ end
165
+
166
+ if message =~ /\Apass ball to @(\w+)\Z/i
167
+ @players[$1][:hasBall] = :yes
168
+ end
169
+
170
+ if message =~ /\Awho has ball\Z/i
171
+ return @players.find { |k, v| v[:hasBall] == :yes }[0]
172
+ end
173
+
174
+ if message =~ /\Aspace\Z/
175
+ exec_bash_visually_and_post_process_strings(
176
+ '/Users/lemonandroid/gam-git-repos/LemonAndroid/gam/managables/programs/game_aided_manufacturing/test.sh'
177
+ )
178
+ end
179
+
180
+ if message =~ /\Achat-variable (\w*) (.*)\Z/i
181
+ variable_value_used_by_chat_user = $2
182
+ return "Coming soon" if variable_value_used_by_chat_user == "selectDiscordMessage"
183
+ variable_identifier_used_by_chat_user = $1
184
+
185
+ if(variable_value_used_by_chat_user =~ /`(.*)`/)
186
+ variable_value_used_by_chat_user = eval($1)
187
+ end
188
+
189
+ @variables_for_chat_users[variable_identifier_used_by_chat_user] = variable_value_used_by_chat_user
190
+
191
+ return space_2_unicode("variable #{variable_identifier_used_by_chat_user} set to #{@variables_for_chat_users[variable_identifier_used_by_chat_user]}")
192
+ end
193
+
194
+ if message =~ /\Aget-chat-variable (\w*)\Z/i
195
+ return [
196
+ space_2_unicode("Getting variable value for key #{$1}"),
197
+ space_2_unicode(@variables_for_chat_users[$1].verbose_introspect(very_verbose=true))
198
+ ].join
199
+ end
200
+
201
+ if message =~ /\Aget-method-definition #{variable_regex}#{method_call_regex}\Z/
202
+ return @variables_for_chat_users[$1].method($2.to_sym).source
203
+ end
204
+
205
+ if message =~ /\A@LemonAndroid List github repos\Z/i
206
+ return "https://api.github.com/users/LemonAndroid/repos"
207
+ end
208
+
209
+ if message =~ /\AList 10 most recently pushed to Github Repos of LemonAndroid\Z/i
210
+ texts = ten_most_pushed_to_github_repos
211
+ texts.each do |text|
212
+ return text
213
+ end
214
+ end
215
+
216
+ if message =~ /\A@LemonAndroid work on (\w+\/\w+)\Z/i
217
+ @currently_selected_project = $1
218
+ return space_2_unicode("currently selected project set to #{@currently_selected_project}")
219
+ end
220
+
221
+ if message =~ /@LemonAndroid currently selected project/i
222
+ return space_2_unicode("currently selected project is #{@currently_selected_project}")
223
+ end
224
+
225
+ if message =~ /\Ashow `(.*)`\Z/i
226
+ test = $1
227
+ return exec_bash_visually_and_post_process_strings(test)
228
+ end
229
+
230
+ if message =~ /\A@LemonAndroid\s+show eval `(.*)`\Z/i
231
+ texts = [eval($1).to_s]
232
+ texts.each do |text|
233
+ return space_2_unicode(text)
234
+ end
235
+ end
236
+
237
+ if message =~ /\Als\Z/i
238
+ texts = execute_bash_in_currently_selected_project('ls')
239
+ texts.each do |text|
240
+ return text
241
+ end
242
+ end
243
+
244
+ if message =~ /\A@LemonAndroid cd ([^\s]+)\Z/i
245
+ path = nil
246
+ Dir.chdir(current_repo_dir) do
247
+ path = File.expand_path(File.join('.', Dir.glob("**/#{$1}")))
248
+ end
249
+ texts = execute_bash_in_currently_selected_project("ls #{path}")
250
+
251
+ return space_2_unicode("Listing directory `#{path}`")
252
+ texts.each do |text|
253
+ return text
254
+ end
255
+ end
256
+
257
+ if message =~ /\A@LemonAndroid cat ([^\s]+)\Z/i
258
+ path = nil
259
+ Dir.chdir(current_repo_dir) do
260
+ path = File.expand_path(File.join('.', Dir.glob("**/#{$1}")))
261
+ end
262
+ texts = execute_bash_in_currently_selected_project("cat #{path}")
263
+
264
+ return space_2_unicode("Showing file `#{path}`")
265
+ texts.each do |text|
266
+ return text
267
+ end
268
+ end
@@ -0,0 +1,3 @@
1
+ module EezeeRegexes
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,6 @@
1
+ require "eezee_regexes/version"
2
+
3
+ module EezeeRegexes
4
+ class Error < StandardError; end
5
+ # Your code goes here...
6
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eezee_regexes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Manuel Arno Korfmann
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-07-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Write a longer description or delete this line.
42
+ email:
43
+ - manu@korfmann.info
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - README.md
52
+ - Rakefile
53
+ - bin/console
54
+ - bin/setup
55
+ - eezee_regexes.gemspec
56
+ - lib/eezee_regexes.rb
57
+ - lib/eezee_regexes/liquidify_regex_rules.rb
58
+ - lib/eezee_regexes/regex_rules.rb
59
+ - lib/eezee_regexes/version.rb
60
+ homepage: https://botcompany.de
61
+ licenses: []
62
+ metadata:
63
+ allowed_push_host: https://rubygems.org
64
+ homepage_uri: https://botcompany.de
65
+ source_code_uri: https://github.com/LemonAndroid/eezee10
66
+ changelog_uri: https://github.com/LemonAndroid/eezee10/CHANGELOG.md
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 3.0.0.beta3
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Write a short summary, because RubyGems requires one.
87
+ test_files: []