Skip to content

Commit 6293028

Browse files
added networking and basic_functions folders and a few functions
1 parent ca733a2 commit 6293028

File tree

6 files changed

+42
-0
lines changed

6 files changed

+42
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/testing.py

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
# utility-functions
2+
3+
## Utility-functions is a python library made by me which contains multiple functions for you to use in your code to make it simpler and easier to read for others.
4+
5+
#### these functions included in these libraries can be simple as getting the current operating system to adding glow to a image using `opencv-python`
6+
7+
#### Functions for other Libraries may also be added in the future, Currently These libraries are planned to have utility-functions written for them.
8+
9+
`opencv-python`
10+
`os`
11+

basic_functions/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Basic_Functions
2+
3+
## This Folder `basic_functions` includes some basic utility functions such as to get the current systems operating system name and specifications.

basic_functions/basic_functions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import platform
2+
3+
def get_os_name():
4+
os_name = platform.system() # Gets Operating System Name, for example: Windows, Linux
5+
version = platform.release() # Gets Release Version of Operating System, for example: will return 10 if it is a Windows 10 machine
6+
7+
return os_name, version # return the info
8+

networking/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Networking
2+
3+
## This Folder `networking` includes some utility functions related to networking such as getting the private and public ip address of the device and much more.

networking/networking.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import socket
2+
3+
def get_private_ip():
4+
"""returns the Private ip address of the current device, May get the private ip for a virtualbox/vmware apdater if it exists on the system"""
5+
6+
device_hostname = socket.gethostname()
7+
ip_address = socket.gethostbyname(device_hostname)
8+
9+
return ip_address
10+
11+
def get_device_hostname():
12+
"""returns the current Device Hostname"""
13+
14+
device_hostname = socket.gethostname()
15+
16+
return device_hostname
17+

0 commit comments

Comments
 (0)