Skip to content

Instantly share code, notes, and snippets.

View abhinav1107's full-sized avatar

Abhinav.K abhinav1107

View GitHub Profile
@abhinav1107
abhinav1107 / Dockerfile
Created July 8, 2018 07:54
docker compose file to create 2 elasticsearch node cluster, 1 redis, and 2 normal python clients. This was written to show Python's pickling and un-pickling process. The required Dockerfile is also added
From python:2.7-alpine
RUN pip install dill redis elasticsearch
@abhinav1107
abhinav1107 / __init__.py
Created May 20, 2018 23:21
__init__ file for a self updating python package hosted using a git repository.
#!/usr/bin/env python
import os
import glob
import warnings
import datetime
# function to self update itself. considering following conditions
# - the current user can write to this directory
@abhinav1107
abhinav1107 / ansible-random-inventory-generator.py
Last active July 17, 2024 22:12
A simple python script to generate ansible inventory host file.
from netaddr import *
import argparse
import random
import string
CHAR_LIST = list(string.ascii_lowercase)
def word_generator(word_length):
random_word = ''.join(random.choice(CHAR_LIST) for _ in range(word_length))
@abhinav1107
abhinav1107 / jenkins-slave-label-check.sh
Created May 15, 2018 02:46
Running different Jenkins for different environments leads to use case where Jenkins jobs are imported from one environment to another. And since jenkins slaves might have different labels/names in different environments, we need to ensure lables are correct for each job
#!/bin/bash
#
# Author: Abhinav Kumar
# About: Script to check
# - if Jenkins is using valid and allowed slave labels only.
# - if jobs are configured to run on slaves with labels which are node names.
# change IFS for the course of this script
OLDIFS=$IFS