Skip to content

Instantly share code, notes, and snippets.

View ashish-mj's full-sized avatar
🏠
Working from home

Ashish M J ashish-mj

🏠
Working from home
View GitHub Profile
from kafka import KafkaProducer
import os
from datetime import datetime
import time
now = datetime.now()
bootstrap_servers = ['localhost:9092']
topicName = 'Media'
producer = KafkaProducer(bootstrap_servers = bootstrap_servers)
from kafka import KafkaConsumer
bootstrap_servers = ['localhost:9092']
topicName = 'Media'
consumer = KafkaConsumer (topicName,bootstrap_servers = bootstrap_servers)
for message in consumer:
print(message)
# This is a comment
# Scalar is a single stored value
Name : Ashish # Scalar, string
Age : 20 # Scalar, int
Graduated : false # Scalar, boolean
kind : ConfigMap
application :
name : CRUD-operations
database :
connection-string : localhost
port : 27017
username : YWRtaW4=
password : YWRtaW4xMjM=
database-name : College
collection-name : Student_Info
import pymongo
import yaml
import base64
class crud_operations:
def __init__(self):
print("Reading YAML file")
with open("config.yml", "r") as stream:
import logging
import yaml
import os
from kafka import KafkaProducer
from datetime import datetime
class fileTransfer:
def __init__(self):
from flask import Flask, render_template
from newsapi import NewsApiClient
app = Flask(__name__)
newsapi = NewsApiClient(api_key='****REPLACE_YOUR_API_KEY****')
@app.route('/')
@app.route('/home')
def home():
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>NewsHub</title>
<link rel="stylesheet" href="../static/css/grid.css">
<link href="https://fonts.googleapis.com/css?family=Lato:100,300,300i,400,700" rel="stylesheet">
<link rel="stylesheet" href="../static/css/home.css">
<link rel="icon" href="../static/images/logo.png" type="image/jpg">
</head>
from flask import Flask, jsonify,request
app = Flask(__name__)
app.config['SECRET_KEY']='XXXXXXX'
players =[
{"Jersey Number": 10,
"Name" : "Sachin Tendulkar",
"Age" : 47,
"Role" : "Batsman",
# This is a sample Dockerfile
# set base image python:3.8-slim-buster
FROM python:3.8-slim-buster
# set working directory as app
WORKDIR /app
# copy requirements.txt file from local (source) to file structure of container (destination)
COPY requirements.txt requirements.txt