Skip to content

Instantly share code, notes, and snippets.

View SamyCoenen's full-sized avatar

Samy Coenen SamyCoenen

View GitHub Profile
@SamyCoenen
SamyCoenen / backup_kibana.sh
Last active March 26, 2018 21:42
Make a backup of your Kibana4 dashboard
#!/bin/bash
# Author: Samy Coenen
# Company: Gluo NV
elasticdump \
--input=https://....................eu-central-1.es.amazonaws.com/.kibana-4 \
--output=$ \
--type=data \
--searchBody='{"filter": { "or": [ {"type": {"value": "dashboard"}}, {"type" : {"value":"visualization"}}] }}' \
> kibana-exported.json
@SamyCoenen
SamyCoenen / checkyaml.py
Created March 27, 2018 10:55
YAML syntax checker written in Python
#!/usr/bin/env python3
# Author: Samy Coenen
# Company: Gluo NV
import yaml
import sys
import os, glob
from argparse import ArgumentParser
def get_args():
@SamyCoenen
SamyCoenen / upload_json_elasticsearch.sh
Created March 27, 2018 10:57
Upload json files to elasticsearch
#!/bin/bash
# Author: Samy Coenen
# Company: Gluo NV
list="$(find . -type f)"
for i in list
do
curl -XPOST 'https://......................eu-central-1.es.amazonaws.com/_bulk' -d @$i
done
@SamyCoenen
SamyCoenen / yaml_check_tags.py
Created March 27, 2018 10:59
YAML begin- and endtag checker, written in Python
#!/usr/bin/env python3
# Author: Samy Coenen
# Company: Gluo NV
import os
from argparse import ArgumentParser
import glob
import checkyaml
def get_args():
parser = ArgumentParser(description='Arguments')
@SamyCoenen
SamyCoenen / trigger_pipeline.p
Created March 27, 2018 11:03
Trigger Gitlab pipeline if it's not already running
import requests
from subprocess import call
params = (('status', 'running'),)
params2 = (('status', 'pending'),)
headers = {'PRIVATE-TOKEN': '$TOKEN'}
url = 'https://gitlab.com/api/v4/projects/......................./pipelines'
r = requests.get(url, params=params,headers=headers)
print r.text
r2 = requests.get(url, params=params2,headers=headers)
print r2.text
@SamyCoenen
SamyCoenen / git_change_author.sh
Last active March 29, 2018 19:55
Change the git author in all the commits with a certain filter
# Author: Samy Coenen
# Company: Gluo NV
git filter-branch --commit-filter 'if [ "$GIT_AUTHOR_NAME" = "old_author" ];
then export GIT_AUTHOR_NAME="New Name"; export GIT_AUTHOR_EMAIL=new_email@example.com;
fi; git commit-tree "$@"'