Skip to content

Instantly share code, notes, and snippets.

View darkleaf's full-sized avatar

Mikhail Kuzmin darkleaf

View GitHub Profile
;; This buffer is for Clojure experiments and evaluation.
;; Press C-j to evaluate the last expression.
;; (ns test1
;; (:require
;; [cats.core :as c]
;; [cats.monad.either :as either]))
;; (defn check-logged-out []
;; (if true
@darkleaf
darkleaf / example.clj
Created October 31, 2017 12:05
match case
(ns example
(:require
[clojure.spec.alpha :as s]
[better-cond.core :as b]))
(defmacro try-> [x & xs]
`(try
(-> ~x ~@xs)
(catch RuntimeException _# nil)))
@darkleaf
darkleaf / index.html
Created January 11, 2017 18:51
react-redux-dependency-injection
<div id="todo-app"></div>
module Browserify
mattr_accessor(:base_dir) { "app/assets/browserify" }
# mattr_accessor(:transform) { 'babelify' }
mattr_accessor(:command) { '$(npm bin)/browserifyinc' }
class << self
def inline_bundle(context, entry: nil, require: nil, external: nil, transform: nil, source_map: true)
p 'inline_bundle'
p entry
#!/bin/sh
ls -l *.gz | \
awk '
{
filename = $9;
"date +%s"|getline current_timestamp;
split(filename,components,"-");
timestamp=components[1];
if((timestamp + 6*60*60) < current_timestamp){

Elasticsearch - поисковый движок с json rest api, использующий Lucene и написанный на Java. Описание всех преимуществ этого движка доступно на официальном сайте. Далее по тексту будем называть Elasticsearch как ES.

Подобные движки используются при сложном поиске по базе документов. Например, поиск с учетом морфологии языка или поиск по geo координатам.

В этом уроке я расскажу про основы ES на примере индексации постов блога. Покажу как фильтровать, сортировать и искать документы.

Что бы урок был максимально кроссплатформенным все запросы к ES я буду делать с помощью CURL. Так же есть плагин для google chrome.

По тексту урока расставлены ссылки на другие источники. В конце урока размещены ссылки для быстрого доступа к документации. Определения незнакомых терминов можно прочитать в [глоссарии](http://www.elasticsearch.org/guide/en/elasticsearch/reference/curre

@darkleaf
darkleaf / test.md
Last active August 29, 2015 14:02
markdown test

anchor link

asdfasdfsa asdf sadf sadf sadf asd sadf sadf sa asdf sadf asdf sdaf asdf asdf

facebook.com
только ростелеком
с клиентской машины
Host Loss% Snt Last Avg Best Wrst StDev
1. 192.168.30.1 0.0% 10 4.3 25.3 2.0 133.1 48.1
2. lo0.bras2.ulrt.net 0.0% 10 3.1 10.4 3.0 65.8 19.6
3. 79.126.125.93 0.0% 10 2.8 3.7 2.5 5.7 1.1
4. ae1.nnov.igw1.vt.ru 0.0% 10 21.7 34.3 21.7 141.9 37.8
1. 192.168.30.1 0.0% 9 2.0 4.2 1.9 21.1 6.3
2. lo0.bras2.ulrt.net 0.0% 9 4.5 4.4 3.2 7.4 1.6
3. 79.126.125.93 0.0% 9 2.8 3.9 2.7 7.2 1.6
4. ae1.nnov.igw1.vt.ru 0.0% 9 22.3 22.6 21.8 25.8 1.3
5. 188.254.78.5 37.5% 8 29.6 31.0 29.3 34.7 2.1
6. xe-11-0-1.frkt-ar2.intl.ip.rostelecom.ru 28.6% 8 71.2 73.0 71.1 78.2 3.0
7. 195.69.147.140 0.0% 8 83.1 83.0 82.3 84.7 0.7
8. 162.159.243.76
@darkleaf
darkleaf / README.md
Last active August 29, 2015 13:58 — forked from clayzermk1/README.md

A representation of the current time of year using the Sun, Earth, and Moon.

The position of the Earth in orbit around the Sun indicates the hour of year. The Earth itself is a pie chart indicating the second of day. The Moon's position in orbit around the Earth indicates the hour of month. The time is updated every second.

CodePen demo

MIT License