Skip to content

Instantly share code, notes, and snippets.

View snoopsD's full-sized avatar

Dmitry Prokov snoopsD

  • Samara, Russia
View GitHub Profile
diff --git a/db/structure.sql b/db/structure.sql
index adeb38781..38365d642 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -2,8 +2,8 @@
-- PostgreSQL database dump
--
--- Dumped from database version 10.6
--- Dumped by pg_dump version 10.6
INSERT INTO tenant1.schema_migrations (version) VALUES ('20191015145347');
INSERT INTO tenant1.schema_migrations (version) VALUES ('20191113052524');
/home/blasta/.rvm/gems/ruby-2.4.6@agiki/gems/rack-mini-profiler-0.10.7/lib/patches/db/pg.rb:90:in `async_exec'
/home/blasta/.rvm/gems/ruby-2.4.6@agiki/gems/rack-mini-profiler-0.10.7/lib/patches/db/pg.rb:90:in `async_exec'
/home/blasta/.rvm/gems/ruby-2.4.6@agiki/gems/activerecord-4.2.10/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/home/blasta/.rvm/gems/ruby-2.4.6@agiki/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract_adapter.rb:484:in `block in log'
/home/blasta/.rvm/gems/ruby-2.4.6@agiki/gems/activesupport-4.2.10/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/blasta/.rvm/gems/ruby-2.4.6@agiki/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract_adapter.rb:478:in `log'
@snoopsD
snoopsD / test work
Last active October 30, 2019 10:24
def frequency(arr)
count_elments = arr.inject(Hash.new(0)) { |total, e| total[e] += 1 ; total }.sort.sort_by { |k,v| -v }
count_elments.map { |el| el[0] }
end
def flatten(arr)
flatten_array ||= []
arr.each do |el|
if el.is_a? Array
## Nginx ###
check process nginx with pidfile /run/nginx.pid
start program = "/usr/sbin/service nginx start"
stop program = "/usr/sbin/service nginx stop"
if cpu > 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if memory usage > 80% for 5 cycles then restart
if failed host 51.15.121.165 port 80 protocol http
then restart
if 3 restarts within 5 cycles then timeout
test1
test2
test3
curl --url localhost:9292/tests/101 -v
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9292 (#0)
> GET /tests/101 HTTP/1.1
> Host: localhost:9292
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
curl --url localhost:9292/tests -v
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9292 (#0)
> GET /tests HTTP/1.1
> Host: localhost:9292
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 201 Created
curl --url localhost:9292/tests -v
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9292 (#0)
> GET /tests HTTP/1.1
> Host: localhost:9292
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 201 Created
curl --url localhost:9292/tests -v
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9292 (#0)
> GET /tests HTTP/1.1
> Host: localhost:9292
> User-Agent: curl/7.58.0
> Accept: */*
>
@snoopsD
snoopsD / test-guru-question.txt
Created May 25, 2019 10:26
Вопрос из теста Ruby test for begginer
what means hash ?
this mean a paragraph2
Matz
Linux