Skip to content

Instantly share code, notes, and snippets.

View samyranavela's full-sized avatar

Samy RANAVELA samyranavela

  • Soustons, France
View GitHub Profile
@samyranavela
samyranavela / unixhttpc.go
Created December 11, 2017 13:19 — forked from teknoraver/unixhttpc.go
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
@samyranavela
samyranavela / install-rabbitmq.sh
Created December 11, 2017 20:49 — forked from yetanotherchris/install-rabbitmq.sh
RabbitMQ on Docker with admin UI
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq
@samyranavela
samyranavela / default
Created February 17, 2018 22:52 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
{
"presets": ["env"]
}
@samyranavela
samyranavela / es_dump.sh
Created March 28, 2018 14:54
Dump ES document
curl http://localhots:9200/{index}/{type}/_search\?size\=1000 | \
jq -rc '.hits.hits[]' | \
while read -r doc; do echo $doc | \
jq '._source' > tests/fixtures/page/`echo $doc | jq -r '._type'`_`echo $doc | jq -r '._id'`.json; \
done \
@samyranavela
samyranavela / Example health-check script with systemd socket activation
Created April 18, 2018 12:56 — forked from kouk/Example health-check script with systemd socket activation
Simple HTTP health-check by abusing systemd socket activation with shell scripts
$ curl --dump-header - localhost:12345
HTTP/1.0 404 Not Found
Content-Type: text/html
Content-Length: 43
Date: Fri, 05 Dec 2014 17:48:56 +0000
<html>
<body>
<h1>WUT</h1>
</html>
@samyranavela
samyranavela / gist:44a4144813fab3a410632a500ae027ca
Created July 26, 2018 13:14
ou can use a top_hits aggregation that groups on the country field, returns 1 doc per group, and orders the docs by the collected date descending: https://stackoverflow.com/questions/29016271/how-to-get-latest-values-for-each-group-with-an-elasticsearch-query
POST /test/_search?search_type=count
{
"aggs": {
"group": {
"terms": {
"field": "country"
},
"aggs": {
"group_docs": {
"top_hits": {
@samyranavela
samyranavela / queries_lorrainejug_gist.js
Created August 29, 2018 09:08 — forked from lucianprecup/queries_lorrainejug_gist.js
Quelques requêtes Elasticsearch utilisées lors de la démonstration Lucene @LorraineJug
//-- pertinence et idf (Jean-Claude Jean après ville=Rueil)
{
"query": {
"bool": {
"should": [
{
"text": {
"nom": "jean"
}
},
@samyranavela
samyranavela / gist:9f8a313e71726e8acd21b00ede3b865b
Created October 4, 2018 10:09 — forked from pironim/gist:2f578c60afb67f156136
git pre-commit hook to check branch name
#!/bin/bash
#
# Pre-commit hooks
# Check branch name
BRANCH_NAME_LENGTH=`git rev-parse --abbrev-ref HEAD | grep -E '^t[0-9]{2,16}\_.*_[A-Za-z]{2,2}$' | wc -c`
if [ ${BRANCH_NAME_LENGTH} -eq 0 ] ; then
echo -e '\E[37;44m'"\033[1mERROR\033[0m in pre-commit hook: vim /export/web/.git/hooks/pre-commit"
echo "Branch name should be like t00000_blah_blah_CA - brand is two letters"
@samyranavela
samyranavela / Instructions.md
Created October 4, 2018 10:12 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example