Skip to content

Instantly share code, notes, and snippets.

View raghavmri's full-sized avatar
🎯
Focusing

Raghav Mrituanjaya raghavmri

🎯
Focusing
View GitHub Profile
data = dict()
def add_data():
while True:
name = input("Name: (type n to exit):")
if name == "n":
break
while True:
number = input("Number: (type n to exit):")
# Q14 A
string = input()
sub_string = input()
string.count(sub_string)
# Q14 B
# 1. ('b', 'o', 'o', 'k')
# 2. (1, 2, 4)
# 3. ('Riya', 'Riya', 'Riya')
# 4. 74
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
if __name__ == '__main__':
app.run()
@raghavmri
raghavmri / python_email.py
Last active March 16, 2022 15:45
A simple way of sending emails using python
# !/usr/bin/python
import smtplib
sender = 'sender@fromdomain.com'
receivers = ['receiver@todomain.com']
# Your Email Meta Data and your message
message = """
From: From Person <sender@fromdomain.com>
To: To Person <receiver@todomain.com>
@raghavmri
raghavmri / simple_rest_api.py
Created December 12, 2021 05:41
A simple REST API using Python and FastAPI
import uvicorn # pip install uvicorn
from fastapi import FastAPI # pip install fastapi
from typing import Optional
# Create the FastAPI application
app = FastAPI()
# A simple example of a GET request
@raghavmri
raghavmri / simple_gui.py
Created December 11, 2021 09:43
A Simple Python GUI made with the help of Tkinter module
#!/usr/bin/python
import tkinter as tk
# create a instance of Tk
root = tk.Tk()
root.title("Simple GUI App") # title of the window
root.geometry("300x300") # size of the window
# root.resizable(0, 0) # disable resizing the window
@raghavmri
raghavmri / main.py
Created December 7, 2021 15:47
A simple QR generator using python
import pyqrcode # pip install pyqrcode
# pip install pypng
# you need to install pypng if you want to convert the qr code to png
import png
# This creates a QR code for our youtube channel
# Can be any text or URL
QRCode = pyqrcode.create(
'https://www.youtube.com/channel/UC5GG_qSQ2OgROyc0fRo0KzQ')
@raghavmri
raghavmri / main.py
Created December 5, 2021 09:00
youtube_downloader_python
# importing the module
from pytube import YouTube, Playlist
from pathlib import Path
import os
# Global variables
file_size = 0
def main():
@raghavmri
raghavmri / .env.test
Last active July 2, 2023 09:17
A simple discord bot crafted using python and discord.py
DISCORD_TOKEN="Here Goes your discord token"
import { Construct } from 'constructs';
import { App, TerraformStack } from 'cdktf';
import { AwsProvider, EC2 } from '@cdktf/provider-aws';
class MyStack extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
// define resources here
new AwsProvider(this, 'aws', {