Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Hey, searching job!

Thomas Decaux ebuildy

🎯
Hey, searching job!
  • DataTok
  • South of France, Sanary sur mer
  • Twitter @ebuildy
View GitHub Profile
@exAspArk
exAspArk / gist:c325bb9a75dcda5c8212
Last active Jul 21, 2022
Elasticsearch: calculating user sessions with Map/Reduce (Ruby)
View gist:c325bb9a75dcda5c8212
# The same algorithm which is used in Google Analytics (https://support.google.com/analytics/answer/2731565?hl=en):
# Time-based expiry (including end of day):
# - After 30 minutes of inactivity
# - At midnight
# Enable dynamic scripting for Groovy (https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html#_enabling_dynamic_scripting)
# ! WARNING: please read about security first
# Usage:
#
@mareksuscak
mareksuscak / bump-version.sh
Created Mar 15, 2015
Bump version shell script.
View bump-version.sh
#!/bin/bash
# Thanks goes to @pete-otaqui for the initial gist:
# https://gist.github.com/pete-otaqui/4188238
#
# Original version modified by Marek Suscak
#
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3" or even "1.2.3-beta+001.ab"
@IvanFernandez
IvanFernandez / SparkToElasticSearch
Last active Oct 10, 2016
Gist to persist from Spark to ElasticSearch
View SparkToElasticSearch
String mode = args[0];
final String collection = args[1];
SparkConf sparkConf = new SparkConf();
sparkConf.set("es.nodes", args[2]);
sparkConf.setAppName("Spark to ElasticSearch PoC");
sparkConf.setMaster(mode);
// Twitter configuration
View php-fpm-cli
#!/bin/bash
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Mathias Leppich <mleppich@muhqu.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@polyfractal
polyfractal / gist:4704772
Last active May 26, 2021
Commands associated with the "Starts-with" ElasticSearch tutorial
View gist:4704772
#Create the index with no mapping
curl -XPUT localhost:9200/startswith/
#add some data
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"river dog"}'
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"data"}'
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"drive"}'
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"drunk"}'
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"dzone"}'
@misja
misja / opengraph.py
Last active Dec 20, 2021
Quick way to extract opengraph and twitter card attributes from a page in python
View opengraph.py
from lxml import html
from urllib import request
from collections import defaultdict
url = "http://www.youtube.com/watch?v=IyLZ6RXJ8Eg"
doc = html.parse(request.urlopen(url))
data = defaultdict(dict)
props = doc.xpath('//meta[re:test(@name|@property, "^twitter|og:.*$", "i")]',
namespaces={"re": "http://exslt.org/regular-expressions"})