Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander Sadovsky Alino

View GitHub Profile
@Alino
Alino / guess.js
Last active Jul 12, 2018
a simple javascript code for a guessing quiz without user interface.
View guess.js
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 Aug 16, 2017
This script hides all cryptocurrencies on coinmarketcap.com whose are not exchangeable on Shapeshift.com
View coinmarketcapFilter.js
// 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',
View sh
#!/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 Oct 27, 2015
elasticsearch top hits query aggregation
View gist:dc75d5c33db8a4b690e5
GET /masterproducts/product/_search
{
"query": {
"bool": {
"must": [{
"term": {
"product._all": "zem"
}
}],
"must_not": [],
View winstonToElastic.conf
input {
tcp { port => 9292 type=>"sample" }
}
filter {
json {
source => "message"
}
}
@Alino
Alino / index
Created Sep 24, 2015
How to filter out elements from an array that doesn’t match the query?
View index
POST /products
{
"settings": {
"analysis": {
"filter": {
"nGram_filter": {
"type": "nGram",
"min_gram": 2,
"max_gram": 20,
"token_chars": [
@Alino
Alino / db.eshops
Last active Aug 29, 2015
db.eshops
View 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 Aug 29, 2015
db.eshops
View 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 Feb 25, 2015
hadanka 12 guliciek
View hadanka12Guliciek
/*
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;
View get product details from pixmania
<?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...");