View gist:c325bb9a75dcda5c8212
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
# |
View bump-version.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
View SparkToElasticSearch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View gist:4704772
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"}' |
View opengraph.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}) |