Skip to content

Instantly share code, notes, and snippets.

@sashaegorov
sashaegorov / es60_tags_search.js
Created January 22, 2018 11:55
ElasticSearch setup for searching tags
// DELETE my-index
// PUT my-index
{
"settings": {
"analysis": {
"analyzer": {
"auto_completion_analyzer": {
"type": "custom",
"filter": [
@sashaegorov
sashaegorov / git_repos_check.sh
Created September 19, 2013 21:05
Simple bash one liner script for bulk git repositories status check.
cwd=`pwd`;for repo in `find . -type d -name '.git'`; do repodir=`echo $repo | sed 's/\.git$//'`; echo "Checking: $repodir"; cd $repodir; git status -s; cd $cwd; done
@sashaegorov
sashaegorov / prime.rb
Created January 11, 2019 10:05
Prime numbers with Ruby endless range
factors = -> (n) { (1..n).select{|x| n % x === 0} }
prime = ->(n){ (factors === n) === [1,n] }
(1..).lazy.select(&prime).take(10).to_a
@sashaegorov
sashaegorov / multipleinheritance.py
Created April 27, 2023 19:32 — forked from litzomatic/multipleinheritance.py
Understanding super and multiple inheritance in Python.
class Bar(object):
def __init__(self, bar='bar', *args, **kwargs):
self.bar = bar
super(Bar, self).__init__(*args, **kwargs)
class Foo(object):
def __init__(self, foo='foo', *args, **kwargs):
self.foo = foo
super(Foo, self).__init__(*args, **kwargs)