-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from gaius-r/integrate1
Main Push 4 : Added Docker, LVM and ML; fixed file path issue in ML
- Loading branch information
Showing
10 changed files
with
227 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import os | ||
import platform | ||
|
||
def lvmAuto(): | ||
|
||
if platform.system() == 'Windows': | ||
print("Current OS is Windows. This Code Block is compatible only with UNIX based systems.") | ||
input("Press Enter to return to menu...") | ||
return | ||
|
||
while True : | ||
os.system("clear") | ||
print("\t\tpress 1: to make LVM partition") | ||
print("\t\tpress 2: to exit") | ||
|
||
ch = input("enter your choice : ") | ||
|
||
if ch == "1": | ||
pv1 = input("enter name/path of the disk 1 : ") | ||
pv2 = input("enter name/path of the disk 2 : ") | ||
os.system("pvcreate /dev/{}".format(pv1)) | ||
os.system("pvcreate /dev/{}".format(pv2)) | ||
vgn = input("enter name for your vg : ") | ||
os.system("vgcreate {} /dev/{} /dev/{}".format(vgn,pv1,pv2)) | ||
lvsize = input("enter size of your lv : ") | ||
lvname = input("enter name of your lv : ") | ||
os.system("lvcreate --size +{} --name {} {}".format(lvsize,lvname,vgn)) | ||
os.system("tput setaf 3") | ||
print("successfully createed logical volume..") | ||
os.system("tput setaf 7") | ||
os.system("lvdisplay /dev/{}/{}".format(vgn,lvname)) | ||
input("press enter to format your lv {}".format(lvname)) | ||
os.system("mkfs.ext4 /dev/{}/{}".format(vgn,lvname)) | ||
print("succesfully formatted you lv {}".format(lvname)) | ||
input("press enter to make folder where u want to mount your lv") | ||
folder = input("enter name for your folder : ") | ||
os.system("mkdir /{}".format(folder)) | ||
print("mounting your lv {} to the /{} folder".format(lvname,folder)) | ||
os.system("mount /dev/{}/{} /{}".format(vgn,lvname,folder)) | ||
print("successfully mounted ur lv {} to /{} folder".format(lvname,folder)) | ||
|
||
elif ch == "2": | ||
break | ||
|
||
else : | ||
print("Invalid choice") | ||
input() | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
YearsExperience,Salary | ||
1.1,39343.00 | ||
1.3,46205.00 | ||
1.5,37731.00 | ||
2.0,43525.00 | ||
2.2,39891.00 | ||
2.9,56642.00 | ||
3.0,60150.00 | ||
3.2,54445.00 | ||
3.2,64445.00 | ||
3.7,57189.00 | ||
3.9,63218.00 | ||
4.0,55794.00 | ||
4.0,56957.00 | ||
4.1,57081.00 | ||
4.5,61111.00 | ||
4.9,67938.00 | ||
5.1,66029.00 | ||
5.3,83088.00 | ||
5.9,81363.00 | ||
6.0,93940.00 | ||
6.8,91738.00 | ||
7.1,98273.00 | ||
7.9,101302.00 | ||
8.2,113812.00 | ||
8.7,109431.00 | ||
9.0,105582.00 | ||
9.5,116969.00 | ||
9.6,112635.00 | ||
10.3,122391.00 | ||
10.5,121872.00 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import os | ||
import platform | ||
|
||
def dockerMenu(): | ||
|
||
if platform.system() == 'Windows': | ||
print("Current OS is Windows. This Code Block is compatible only with Red Hat Enterprise Linux.") | ||
input("Press Enter to return to menu...") | ||
return | ||
|
||
print("\t\t\tWhat do you want to do? \n") | ||
print("\t\t1 : Install docker") | ||
print("\t\t2 : Start docker service") | ||
print("\t\t3 : Stop docker service") | ||
print("\t\t4 : View docker info") | ||
print("\t\t5 : View active containers") | ||
print("\t\t6 : View all containers") | ||
print("\t\t7 : View downloaded images") | ||
print("\t\t8 : Pull an image") | ||
print("\t\t9 : Launch a container") | ||
print("\t\t10 : Stop a container") | ||
print("\t\t11 : Start a container") | ||
print("\t\t12 : Remove an image") | ||
print("\t\t13 : Remove a container") | ||
print("\t\t0 : Exit") | ||
print() | ||
while(True): | ||
option=int(input("\n\tEnter your choice : ")) | ||
|
||
if (option==1): | ||
if not os.system("{} rpm -q docker-ce"): | ||
print("\tDocker is already installed. Exiting installation...") | ||
else: | ||
print("\tInstalling Docker...") | ||
file=open("/etc/yum.repos.d/docker-ce_install.repo","a") | ||
dockrepo = "[docker]\nbaseurl=https://download.docker.com/linux/centos/7/x86_64/stable/\ngpgcheck=0\n" | ||
file.write(dockrepo) | ||
file.close() | ||
os.system("yum install docker-ce --nobest") | ||
|
||
elif (option==2): | ||
os.system("systemctl start docker") | ||
|
||
elif (option==3): | ||
os.system("systemctl stop docker") | ||
|
||
elif (option==4): | ||
os.system("docker info") | ||
|
||
elif (option==5): | ||
os.system("docker ps") | ||
|
||
elif (option==6): | ||
os.system("docker ps -a") | ||
|
||
elif (option==7): | ||
os.system("docker images") | ||
|
||
elif (option==8): | ||
image=input("\tEnter image name: ") | ||
version=input("\tEnter image version (optional): ") | ||
if image: | ||
if version != "" : | ||
os.system("docker pull {}:{}".format(image,version)) | ||
else : | ||
os.system("docker pull {}".format(image)) | ||
else: | ||
print("\n\tNo image name entered!") | ||
|
||
elif (option==9): | ||
img = input("\tEnter image name: ") | ||
ver = input("\tEnter image version (optional): ") | ||
name = input("\tEnter container name: ") | ||
if image: | ||
if version != "" : | ||
os.system("docker run -it --name {} {}:{}".format(name,image,version)) | ||
else : | ||
os.system("docker run -it --name {} {}".format(name,image)) | ||
else: | ||
print("\n\tNo image name entered!") | ||
|
||
elif (option==10): | ||
name_id = input("\tEnter container name or id: ") | ||
if name_id : | ||
os.system("docker stop {}".format(name_id)) | ||
else : | ||
print("\tPlease enter a container name/ID!") | ||
|
||
elif (option==11): | ||
name_id = input("\tEnter container name or ID: ") | ||
if name_id : | ||
os.system("docker start {}".format(name_id)) | ||
else : | ||
print("\tPlease enter a container name/ID!") | ||
|
||
elif(option==12): | ||
img = input("\tEnter image name: ") | ||
ver = input("\tEnter image version (optional): ") | ||
if img: | ||
if ver != "" : | ||
os.system("docker rmi {}:{} --force".format(img,ver)) | ||
else: | ||
os.system("docker rmi {} --force".format(img)) | ||
else: | ||
print("\tPlease enter an image name!") | ||
|
||
elif (option==13): | ||
name_id = input("\tEnter container name or ID: ") | ||
if name_id : | ||
os.system("docker rm {}".format(name_id)) | ||
else : | ||
print("\tPlease enter a container name/ID!") | ||
|
||
elif (option==0): | ||
break | ||
else: | ||
print("\tInvalid choice!\n") | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -274,6 +274,4 @@ def ec2menu(prof): | |
else: | ||
print("Invalid choice!!! Choose from 1-15 or Q to exit.\n") | ||
return | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import pandas | ||
dataset=pandas.read_csv('/root/Salary_Data.csv') | ||
y=dataset['Salary'] | ||
x=dataset['YearsExperience'] | ||
from sklearn.linear_model import LinearRegression | ||
x=x.values | ||
x=x.reshape(-1,1) | ||
model=LinearRegression() | ||
model.fit(x,y) | ||
exp=input('\t\t\t\tEnter Value to Predict from DataSet :- ') | ||
print('\t\t\t\tPredicted Value is :- ', end='') | ||
print(model.predict([[float(exp)]])) | ||
print() | ||
|
||
|
||
def mlModel(): | ||
dataset = pandas.read_csv(r"pythonMenuStack\Salary_Data.csv") | ||
print(dataset.head()) | ||
y = dataset['Salary'] | ||
x = dataset['YearsExperience'] | ||
x = x.values | ||
x = x.reshape(-1, 1) | ||
model = LinearRegression() | ||
model.fit(x, y) | ||
exp = input('\t\t\t\tEnter Value to Predict from DataSet :- ') | ||
print('\t\t\t\tPredicted Value is :- ', end='') | ||
print(model.predict([[float(exp)]])) | ||
print() | ||
return |
This file was deleted.
Oops, something went wrong.