Skip to content

Instantly share code, notes, and snippets.

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

vjayc vjayajv

🏠
Working from home
View GitHub Profile
@vjayajv
vjayajv / README.md
Last active November 12, 2020 04:48

Stop-watch without using date command in shell script


set -e


i=00;

for i in $(seq -f %02g 0 24);
@vjayajv
vjayajv / aep.html
Last active May 26, 2021 14:45
mongodb-crud-using-flask
<!DOCTYPE html>
<html lang="en">
<head>
<title>Mongo-CRD</title>
<link rel="shortcut icon" type="image/jpg" href="http://mongodb-js.github.io/leaf/mongodb-leaf_512x512.png"/>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
from flask import Flask, flash, render_template, request, redirect, url_for
from pymongo import MongoClient
from bson.objectid import ObjectId
import os
# we're passing mongo's IP as env variable to docker run command
mongohost = str(os.environ['MONGOHOST'])
DEBUG = True
app = Flask(__name__,template_folder='./templates')
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<title>Mongo-CRD</title>
<link rel="shortcut icon" type="image/jpg" href="http://mongodb-js.github.io/leaf/mongodb-leaf_512x512.png"/>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
</head>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Mongo-CRD</title>
<link rel="shortcut icon" type="image/jpg" href="http://mongodb-js.github.io/leaf/mongodb-leaf_512x512.png"/>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
@vjayajv
vjayajv / bit-bucket-pr-manager.sh
Created January 19, 2022 06:43
A shell-script to create and merge pull-requests in bit-bucket.
#!/bin/bash
function usage
{
echo "This script is used to create a PR for a specified branch"
echo "usage: ./pull-requests.sh [-h --help] | [-u --username] USERNAME | [-p --password] PASSWORD | [-w --workspace] WORKSPACE | [-r --repo] | [-s --source] SOURCE_BRANCH [-d --destination] DESTINATION_BRANCH [-a --action] ACTION_TYPE | [--desc] DESCRIPTION"
echo "-a --action Allowed values : create (create), merge(create and merge) , default is create"
echo "Example: ./pull-request.sh -r myrepo -s develop -d master"
}
@vjayajv
vjayajv / mongo_metrics.py
Created February 2, 2022 14:42
Python script to fetch mongo metrics from atlas and store them to influx
import time
from datetime import datetime
import json
import requests
from requests.auth import HTTPDigestAuth
from influxdb import InfluxDBClient
client = InfluxDBClient(host='localhost', port=8085)
client.create_database('writetest')
@vjayajv
vjayajv / switch_case.py
Created February 3, 2022 07:51
Switch Case using a JSON map in python
def foo(bla):
print(str(bla)+" from foo method")
# your statements
def bar(bla):
print(str(bla)+" from bar method")
# your statements
action_map = {
"dofoo": foo,
@vjayajv
vjayajv / containerd-filebeat.yml
Created March 21, 2023 12:36
Filebeat.yml for the death of dockershim
---
apiVersion: v1
kind: ConfigMap
metadata:
name: filebeat-config
labels:
k8s-app: filebeat
data:
filebeat.yml: |-
filebeat.inputs:
---
apiVersion: v1
kind: ConfigMap
metadata:
name: filebeat-config
labels:
k8s-app: filebeat
data:
filebeat.yml: |-