mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-24 04:21:12 +00:00
Merge branch 'metafy-social:master' into master
This commit is contained in:
commit
c04be740f9
56
scripts/Calender/calender.py
Normal file
56
scripts/Calender/calender.py
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
from tkinter import *
|
||||||
|
import tkinter as tk
|
||||||
|
from PIL import ImageTk, Image
|
||||||
|
import calendar
|
||||||
|
root = tk.Tk()
|
||||||
|
root.geometry('400x300')
|
||||||
|
root.title('Calender-Techarge')
|
||||||
|
root.iconbitmap("calender-ico.ico")
|
||||||
|
|
||||||
|
|
||||||
|
def show():
|
||||||
|
|
||||||
|
m = int(month.get())
|
||||||
|
y = int(year.get())
|
||||||
|
output = calendar.month(y,m)
|
||||||
|
|
||||||
|
cal.insert('end',output)
|
||||||
|
|
||||||
|
def clear():
|
||||||
|
cal.delete(1.0,'end')
|
||||||
|
|
||||||
|
def exit():
|
||||||
|
root.destroy()
|
||||||
|
|
||||||
|
|
||||||
|
img = ImageTk.PhotoImage(Image.open('calendar.png'))
|
||||||
|
label = Label(image=img)
|
||||||
|
label.place(x=170,y=3)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
m_label = Label(root,text="Month",font=('verdana','10','bold'))
|
||||||
|
m_label.place(x=70,y=80)
|
||||||
|
|
||||||
|
month = Spinbox(root, from_= 1, to = 12,width="5")
|
||||||
|
month.place(x=140,y=80)
|
||||||
|
|
||||||
|
y_label = Label(root,text="Year",font=('verdana','10','bold'))
|
||||||
|
y_label.place(x=210,y=80)
|
||||||
|
|
||||||
|
year = Spinbox(root, from_= 2020, to = 3000,width="8")
|
||||||
|
year.place(x=260,y=80)
|
||||||
|
|
||||||
|
|
||||||
|
cal = Text(root,width=33,height=8,relief=RIDGE,borderwidth=2)
|
||||||
|
cal.place(x=70,y=110)
|
||||||
|
|
||||||
|
show = Button(root,text="Show",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=show)
|
||||||
|
show.place(x=140,y=250)
|
||||||
|
|
||||||
|
clear = Button(root,text="Clear",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=clear)
|
||||||
|
clear.place(x=200,y=250)
|
||||||
|
|
||||||
|
exit = Button(root,text="Exit",font=('verdana',10,'bold'),relief=RIDGE,borderwidth=2,command=exit)
|
||||||
|
exit.place(x=260,y=250)
|
||||||
|
root.mainloop()
|
8
scripts/Calender/readme.txt
Normal file
8
scripts/Calender/readme.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
###Calender App using Python
|
||||||
|
This is an simple calender gui using python.
|
||||||
|
|
||||||
|
#Steps:
|
||||||
|
*We will require tkinter and calender module.
|
||||||
|
*pip install tkinter
|
||||||
|
*pip install calendar module
|
||||||
|
*Run- python calender.py
|
20
scripts/Message Encoder and Decoder/README.md
Normal file
20
scripts/Message Encoder and Decoder/README.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Message Encoder and Decoder
|
||||||
|
|
||||||
|
A web application used to encrypt and decrypt text messages.
|
||||||
|
- For the encodings listed in RFC 4648, it offers encoding and decoding functions.
|
||||||
|
|
||||||
|
## Tech Stack 🛠
|
||||||
|
![Python](https://img.shields.io/badge/Python-3.9-yellowgreen)
|
||||||
|
![Streamlit](https://img.shields.io/badge/Streamlit-0.85.1-red)
|
||||||
|
![base64](https://img.shields.io/badge/-base64-lightgrey)
|
||||||
|
|
||||||
|
## Features ⚡
|
||||||
|
|
||||||
|
- Encoding and Decoding using Private Key
|
||||||
|
- Neat and Clean UI
|
||||||
|
|
||||||
|
## Demo 👀
|
||||||
|
|
||||||
|
[streamlit-app-encode-decode.webm](https://user-images.githubusercontent.com/81156510/183291295-e759eb45-0c1c-4d4e-9f5a-e2f3f95f8a72.webm)
|
||||||
|
|
||||||
|
<hr>
|
45
scripts/Message Encoder and Decoder/app.py
Normal file
45
scripts/Message Encoder and Decoder/app.py
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
import streamlit as st
|
||||||
|
import base64
|
||||||
|
|
||||||
|
# Function to Encode
|
||||||
|
|
||||||
|
def Encode(key, message):
|
||||||
|
enc=[]
|
||||||
|
for i in range(len(message)):
|
||||||
|
key_c = key[i % len(key)]
|
||||||
|
enc.append(chr((ord(message[i]) + ord(key_c)) % 256))
|
||||||
|
|
||||||
|
return base64.urlsafe_b64encode("".join(enc).encode()).decode()
|
||||||
|
|
||||||
|
|
||||||
|
# Function to decode
|
||||||
|
|
||||||
|
def Decode(key, message):
|
||||||
|
dec=[]
|
||||||
|
message = base64.urlsafe_b64decode(message).decode()
|
||||||
|
for i in range(len(message)):
|
||||||
|
key_c = key[i % len(key)]
|
||||||
|
dec.append(chr((256 + ord(message[i])- ord(key_c)) % 256))
|
||||||
|
|
||||||
|
return "".join(dec)
|
||||||
|
|
||||||
|
message = st.text_input('Message Text')
|
||||||
|
|
||||||
|
key = st.text_input(
|
||||||
|
"Private key", type="password"
|
||||||
|
)
|
||||||
|
|
||||||
|
mode = st.selectbox(
|
||||||
|
"What action would you like to perform?",
|
||||||
|
("Encode", "Decode")
|
||||||
|
)
|
||||||
|
|
||||||
|
if st.button('Result'):
|
||||||
|
if (mode == "Encode"):
|
||||||
|
# Encode(key, message)
|
||||||
|
st.write(Encode(key, message))
|
||||||
|
else:
|
||||||
|
st.write(Decode(key, message))
|
||||||
|
else:
|
||||||
|
st.write('Please enter all the required information!!')
|
||||||
|
|
13
scripts/battery_notification/README.md
Normal file
13
scripts/battery_notification/README.md
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
This python File used to give notification about your battery percentage of the device.
|
||||||
|
|
||||||
|
|
||||||
|
Pre-requisites:-you need to install python on your desktop along with some awesome packages as follows:-
|
||||||
|
|
||||||
|
1.)psutil :-pip install psutil
|
||||||
|
|
||||||
|
2.)pynotifier :- pip install py-notifier
|
||||||
|
|
||||||
|
3.)win10toast :- pip install win10toast
|
||||||
|
|
||||||
|
|
||||||
|
thanks for reading!!
|
19
scripts/battery_notification/battery_notification.py
Normal file
19
scripts/battery_notification/battery_notification.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# pip install psutil
|
||||||
|
import psutil
|
||||||
|
|
||||||
|
battery = psutil.sensors_battery()
|
||||||
|
plugged = battery.power_plugged
|
||||||
|
percent = battery.percent
|
||||||
|
|
||||||
|
if percent <= 30 and plugged!=True:
|
||||||
|
|
||||||
|
# pip install py-notifier
|
||||||
|
# pip install win10toast
|
||||||
|
from pynotifier import Notification
|
||||||
|
|
||||||
|
Notification(
|
||||||
|
title="Battery Low",
|
||||||
|
description=str(percent) + "% Battery remain!!",
|
||||||
|
duration=5, # Duration in seconds
|
||||||
|
|
||||||
|
).send()
|
3
scripts/battery_notification/requirement.txt
Normal file
3
scripts/battery_notification/requirement.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
psutil==5.7.2
|
||||||
|
py-notifier==0.1
|
||||||
|
win10toast==0.9
|
13
scripts/otp_generator/generateOTP.py
Normal file
13
scripts/otp_generator/generateOTP.py
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
import random
|
||||||
|
def otp(num):
|
||||||
|
result=""
|
||||||
|
if(len(str(num))==10):
|
||||||
|
for i in range(6):
|
||||||
|
digit=str(random.randint(0,9))
|
||||||
|
result=result+digit
|
||||||
|
return result
|
||||||
|
else:
|
||||||
|
s="Enter a valid mobile number!"
|
||||||
|
return s
|
||||||
|
|
||||||
|
print(otp(9874453920))
|
5
scripts/otp_generator/readme.md
Normal file
5
scripts/otp_generator/readme.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
# OTP GENERATOR
|
||||||
|
|
||||||
|
In this project, a 6 digit OTP will be auto generated when user gives a valid 10 digit mobile number. This is written in python and can be implemented in websites as well for authentication.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user