Skip to content

Instantly share code, notes, and snippets.

View ebuildy's full-sized avatar
🌴
A Montréal - hey bière ??

Thomas Decaux ebuildy

🌴
A Montréal - hey bière ??
View GitHub Profile
#!/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
@mareksuscak
mareksuscak / bump-version.sh
Created March 15, 2015 12:56
Bump version shell script.
#!/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"
@exAspArk
exAspArk / gist:c325bb9a75dcda5c8212
Last active July 21, 2022 08:46
Elasticsearch: calculating user sessions with Map/Reduce (Ruby)
# 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:
#
@misja
misja / opengraph.py
Last active December 20, 2021 08:30
Quick way to extract opengraph and twitter card attributes from a page in python
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"})
@polyfractal
polyfractal / gist:4704772
Last active May 26, 2021 17:38
Commands associated with the "Starts-with" ElasticSearch tutorial
#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"}'
@IvanFernandez
IvanFernandez / SparkToElasticSearch
Last active October 10, 2016 17:19
Gist to persist from Spark to ElasticSearch
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