Skip to content

Instantly share code, notes, and snippets.

View kanapuli's full-sized avatar
🏠
Working from home

Athavan Kanapuli kanapuli

🏠
Working from home
View GitHub Profile
@kanapuli
kanapuli / docker-compose.yaml
Created January 23, 2024 18:27
Docker compose file for Mysql, Debezium and Kafka setup
version: "2"
services:
zookeeper:
image: confluentinc/cp-zookeeper:5.5.1
container_name: zookeeper
environment:
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_CLIENT_PORT: 2181
ports:
- "2181:2181"
@kanapuli
kanapuli / kafka-replay-events.go
Created September 16, 2022 08:54
A kafka consumer code to replay events based on timestamps
package main
import (
"fmt"
"github.com/confluentinc/confluent-kafka-go/kafka"
"github.com/google/uuid"
"log"
"os"
"strconv"
"time"
@kanapuli
kanapuli / Jenkinsfile
Created December 2, 2019 04:18 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage c…
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8-alpine
@kanapuli
kanapuli / Jenkinsfile
Created September 3, 2019 02:14
Jenkinsfile Format
@Library('github.com/triologygmbh/jenkinsfile@ad12c8a9') _
pipeline {
agent { label 'docker' } // Require a build executor with docker
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '10'))
}
# This tells kubecfg to read its config from the local directory
export KUBECONFIG=./kubeconfig
# Looking at the cluster
kubectl get nodes
kubectl get pods --namespace=kube-system
# Running a single pod
kubectl run --generator=run-pod/v1 --image=gcr.io/kuar-demo/kuard-amd64:1 kuard
kubectl get pods
@kanapuli
kanapuli / find-old-branches.sh
Created July 12, 2019 08:13 — forked from mroderick/find-old-branches.sh
A small script to find stale branches
#!/bin/bash
# This is a very naive script, it doesn't do grouping and returns all branches
# I only really care about branches that have not seen commits in two months
#
# I am hoping to find some time to write a tool that can output these reports for me
# In the meantime, I am using this
echo "Merged branches"
for branch in `git branch -r --merged | grep -v HEAD`;do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch; done | sort -r
//AND operation syntax
{
"query":{
"bool":{
"must":[]
}
}
}
//OR operation syntax
//match query retrieves all documents which has a title like 'Japan%'
{
"_source":["id","name"],
"query":{
"match":{
"title": "Japan"
}
}
}
{
"_source":["id","name"],
"query":{
"match_all":{}
}
}