Skip to content

Instantly share code, notes, and snippets.

View Alino's full-sized avatar

Alexander Sadovsky Alino

  • Bratislava
View GitHub Profile
@Alino
Alino / guess.js
Last active July 12, 2018 20:15
a simple javascript code for a guessing quiz without user interface.
const people = [{
name: 'Homer',
role: 'parent',
gender: 'male',
hobby: 'drinking beer'
}, {
name: 'Marge',
role: 'parent',
gender: 'female',
hobby: 'talking to sisters'
@Alino
Alino / coinmarketcapFilter.js
Last active August 16, 2017 13:38
This script hides all cryptocurrencies on coinmarketcap.com whose are not exchangeable on Shapeshift.com
// 1. navigate to https://coinmarketcap.com/all/views/all/
// 2. open console (F12)
// 3. insert this script and hit enter
// 4. currencies which are not in the shapeShiftCurrencies array should be hidden
// 5. optional: run this script again and it will show back the currencies.
$('.no-wrap.currency-name').each(function() {
const shapeShiftCurrencies = [
'Bitcoin',
'Ethereum',
@Alino
Alino / sh
Created February 2, 2016 14:20
#!/usr/bin/env bash
exec $ES_HOME/bin/elasticsearch "$@"
echo 'waiting for elasticsearch server to come up...'
until $(curl --output /dev/null --silent --head --fail http://127.0.0.1:9200); do
printf '.'
sleep 2
done
./$ES_HOME/createMappings.sh
@Alino
Alino / gist:dc75d5c33db8a4b690e5
Created October 27, 2015 09:34
elasticsearch top hits query aggregation
GET /masterproducts/product/_search
{
"query": {
"bool": {
"must": [{
"term": {
"product._all": "zem"
}
}],
"must_not": [],
input {
tcp { port => 9292 type=>"sample" }
}
filter {
json {
source => "message"
}
}
@Alino
Alino / index
Created September 24, 2015 08:01
How to filter out elements from an array that doesn’t match the query?
POST /products
{
"settings": {
"analysis": {
"filter": {
"nGram_filter": {
"type": "nGram",
"min_gram": 2,
"max_gram": 20,
"token_chars": [
@Alino
Alino / db.eshops
Last active August 29, 2015 14:23
db.eshops
{
"_id" : ObjectId("53e87e239ae974e6a0a81004"),
"name" : "www.example.com",
"products" : [
{
"name" : "apple",
"status" : 1 //this got updated from 0 to 1
},
{
"name" : "banana",
@Alino
Alino / db.eshops
Last active August 29, 2015 14:23
db.eshops
{
"_id" : ObjectId("53e87e239ae974e6a0a81004"),
"name" : "www.example.com",
"products" : [
{
"name" : "apple", //lets say the name key here is primary key of products
"status" : 0
},
{
"name" : "banana",
@Alino
Alino / hadanka12Guliciek
Created February 25, 2015 21:15
hadanka 12 guliciek
/*
Toto je pseudo kod ku hadanke ako logicky zistit ktora z dvanastich guliciek ma inu vahu ako vsetky ostatne gulicky.
Gulicky sa mozu odvazit dokopy 3x na vahe.
*/
var gulicky = [0,1,2,3,4,5,6,7,8,9,10,11];
var specialGulicka = Math.floor(Math.random() * 11) + 0;
var vazenia = 3;
var viemKtoraGulicka = false;
var viemVktorejSkupineJeAsiGulicka = false;
<?php
/**
* This script is meant to be run from terminal or command line
*/
error_reporting(E_ERROR | !E_WARNING | E_PARSE);
$dom = new DOMDocument();
if (!$dom->loadHTMLFile('http://www.pixmania.co.uk/roadworks/playmobil-4820-ladder-unit/04373247-a.html')) {
die("there was an error downloading the product page, now exiting...");