Skip to content

Instantly share code, notes, and snippets.

View Tyralion's full-sized avatar

Ivan Pilyaev Tyralion

  • Russia, Chelyabinsk
View GitHub Profile
@Tyralion
Tyralion / pg.sql
Created October 28, 2016 05:50
inser or update
create table test (a varchar(255), b varchar(255), c integer);
create unique index idx_test_a_b on test (a, b);
insert into test values ('a', 'foo', 1);
select * from test;
insert into test values ('a', 'foo', 1) on conflict (a, b) do update set a = 'c';
select * from test;
drop table test;
"%{title}. Читать подбробнее" % { title: @news_of_the_day.first(2).map(&:title) }
module ActionDispatchPatch
module Utils
def check_param_encoding(params)
case params
when Array
params.each { |element| check_param_encoding(element) }
@Tyralion
Tyralion / site.conf
Created August 30, 2016 05:15 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
module NumericExt
def humanize_time
secs = self
[
[60, :сек],
[60, :мин],
[24, :ч],
irb(main):008:0> req = Laximo.oem.get_wizard2('CH1106')
opening connection to ws.laximo.net:443...
opened
starting SSL for ws.laximo.net:443...
SSL established
<- "POST /ec.Kito.WebCatalog/services/Catalog.CatalogHttpSoap11Endpoint/ HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: LaximoRuby [0.4.2]\r\nContent-Type: text/xml; charset=UTF-8\r\nSoapaction: \"http://WebCatalog.Kito.ec\"\r\nConnection: close\r\nHost: ws.laximo.net\r\nContent-Length: 579\r\n\r\n"
<- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"\nxmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <SOAP-ENV:Body>\n <ns5692:QueryData xmlns:ns5692=\"http://WebCatalog.Kito.ec\">\n <request xsi:type=\"xsd:string\">GetWizard2:Locale=ru_
irb(main):007:0* req = Laximo.oem.get_wizard2('ch1106')
opening connection to ws.laximo.net:443...
opened
starting SSL for ws.laximo.net:443...
SSL established
<- "POST /ec.Kito.WebCatalog/services/Catalog.CatalogHttpSoap11Endpoint/ HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: LaximoRuby [0.4.2]\r\nContent-Type: text/xml; charset=UTF-8\r\nSoapaction: \"http://WebCatalog.Kito.ec\"\r\nConnection: close\r\nHost: ws.laximo.net\r\nContent-Length: 579\r\n\r\n"
<- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"\nxmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <SOAP-ENV:Body>\n <ns5692:QueryData xmlns:ns5692=\"http://WebCatalog.Kito.ec\">\n <request xsi:type=\"xsd:string\">GetWizard2:Locale=ru_
irb(main):001:0> req = Laximo.oem.get_wizard2('DACIA201507')
opening connection to ws.laximo.net:443...
opened
starting SSL for ws.laximo.net:443...
SSL established
<- "POST /ec.Kito.WebCatalog/services/Catalog.CatalogHttpSoap11Endpoint/ HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: LaximoRuby [0.4.2]\r\nContent-Type: text/xml; charset=UTF-8\r\nSoapaction: \"http://WebCatalog.Kito.ec\"\r\nConnection: close\r\nHost: ws.laximo.net\r\nContent-Length: 584\r\n\r\n"
<- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"\nxmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <SOAP-ENV:Body>\n <ns5692:QueryData xmlns:ns5692=\"http://WebCatalog.Kito.ec\">\n <request xsi:type=\"xsd:string\">GetWizard2:Local
irb(main):002:0> req = Laximo.oem.find_vehicle_by_vin('JMZGH12F701448756')
opening connection to ws.laximo.net:443...
opened
starting SSL for ws.laximo.net:443...
SSL established
<- "POST /ec.Kito.WebCatalog/services/Catalog.CatalogHttpSoap11Endpoint/ HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: LaximoRuby [0.4.2]\r\nContent-Type: text/xml; charset=UTF-8\r\nSoapaction: \"http://WebCatalog.Kito.ec\"\r\nConnection: close\r\nHost: ws.laximo.net\r\nContent-Length: 603\r\n\r\n"
<- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"\nxmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <SOAP-ENV:Body>\n <ns5692:QueryData xmlns:ns5692=\"http://WebCatalog.Kito.ec\">\n <request xsi:type=\"xsd:string\">Fi
irb(main):038:0* Laximo.oem.list_catalogs
opening connection to ws.laximo.net:443...
opened
starting SSL for ws.laximo.net:443...
SSL established
<- "POST /ec.Kito.WebCatalog/services/Catalog.CatalogHttpSoap11Endpoint/ HTTP/1.1\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: LaximoRuby [0.4.2]\r\nContent-Type: text/xml; charset=UTF-8\r\nSoapaction: \"http://WebCatalog.Kito.ec\"\r\nConnection: close\r\nHost: ws.laximo.net\r\nContent-Length: 561\r\n\r\n"
<- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"\nxmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <SOAP-ENV:Body>\n <ns5692:QueryData xmlns:ns5692=\"http://WebCatalog.Kito.ec\">\n <request xsi:type=\"xsd:string\">ListCatalogs:Locale=ru_RU</request>