Skip to content

Instantly share code, notes, and snippets.

View ajahongir's full-sized avatar

Jakhongir Alimov(ajahongir) ajahongir

View GitHub Profile
import warnings
import json
warnings.filterwarnings("ignore")
from dejavu import Dejavu
from dejavu.recognize import FileRecognizer, MicrophoneRecognizer
# load config from a JSON file (or anything outputting a python dictionary)
with open("dejavu.cnf.SAMPLE") as f:
config = json.load(f)
@ajahongir
ajahongir / main.rb
Created February 5, 2015 07:24
sample test method
def solution(x, a)
return 0 if a.empty? || !x.is_a?(Integer)
indexes = matched_indexes(a, x)
not_matched = a.size - indexes.size
k = -1
return k if indexes.size <= 1 || not_matched.odd?
indexes.each do |ind, count|
if ind > count + not_matched / 2
k = ind - not_matched / 2
@ajahongir
ajahongir / api interface
Last active August 29, 2015 14:05
api interface
###client side###
request_parser_url = 'http://parsing.clickavia.ru/parsing'
options = {
datafile: {
title: 'ntk_mow_boj_csv',
parser: {
rule: 'some_rule',
city_from: 'MOW',
city_to: 'BOJ',
flight_class: 'econom',