Skip to content

Instantly share code, notes, and snippets.

View imran-baig-se's full-sized avatar

Imran Baig imran-baig-se

View GitHub Profile
@imran-baig-se
imran-baig-se / adding your filter
Created April 15, 2018 21:20
adding your filter for ELK path: dockers-elk/logstash/pipeline/logstash.conf
filter {
json {
source => "message"
}
mutate {
add_field => { "index_name" => "www-log" }
}
}
@imran-baig-se
imran-baig-se / ipassign
Created December 31, 2017 11:48 — forked from jsianes/ipassign
Script to assign Public IP from Elastic IP pool for instances hosted in AWS. 'ec2-utils' and AWS CLI packages required. Instance role or access keys need to allow at least next EC2 actions: describe-addresses, associate-address and disassociate-address. Shell script is designed to be integrated with instance start-up
#!/bin/bash
# chkconfig: 2345 99 10
# description: Set Public IP from ElasticIP pool during instance startup
# processname: ipassign
# Provides: ipassign
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Set Public IP from ElasticIP pool during instance startup
@imran-baig-se
imran-baig-se / check_docker_tag.sh
Created August 19, 2017 08:44 — forked from ryanmaclean/check_docker_tag.sh
Check if Docker Image with Tag Exists
#!/bin/bash
# This script will check to see if a Docker image exists for a specific tag.
# Taken from here, with love: https://www.reddit.com/r/docker/comments/4hwdma/check_if_an_image_tag_for_a_private_repo_exists/
TOKEN=$( curl -sSLd "username=${DOCKER_HUB_USERNAME}&password=${DOCKER_HUB_PASSWORD}" https://hub.docker.com/v2/users/login | jq -r ".token" )
curl -sH "Authorization: JWT $TOKEN" "https://hub.docker.com/v2/repositories/${DOCKER_REPO}/tags/${DOCKER_TAG}/" | jq .
#{
# "name": "latest",
# "id": 780668,
@imran-baig-se
imran-baig-se / clean-branchs.sh
Created April 12, 2017 08:13
Clean git branches by specifying months
#!/usr/bin/env bash
# fetch all branches:
for k in $(git branch -a | sed /\*/d); do
# check if there is no changes since 3 month
if [ -z "$(git log -1 --since='3 month ago' -s $k)" ]; then
# prepare branch name
branch_name_with_no_origin=$(echo $k | sed -e "s/origin\///" | sed -e "s/remotes\///" )
echo deleting branch: $branch_name_with_no_origin
# keep master | develop branch even if they are outdated.