Skip to content

Instantly share code, notes, and snippets.

View dat-adi's full-sized avatar
🔘
I don't even know what I don't know.

Dat Adithya dat-adi

🔘
I don't even know what I don't know.
View GitHub Profile
@dat-adi
dat-adi / what-a-gist.py
Created May 5, 2020 18:54
What's a gist?
View what-a-gist.py
print("You might question as to what a gist is.")
print("Well, I hate to break it to ya, but, i'm asking the same question.")
@dat-adi
dat-adi / test_sheet.py
Last active January 17, 2021 07:35
A small snippet of code to exhibit the functionality of Google Sheets in Python.
View test_sheet.py
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint
#sheet access
scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]
# used to retrieve credentials from the *creds.json* file
creds = ServiceAccountCredentials.from_json_keyfile_name("creds.json", scope)
client = gspread.authorize(creds)
@dat-adi
dat-adi / psutil-system-demo.py
Last active December 19, 2021 17:17
A compilation of functions of the `psutil` module.
View psutil-system-demo.py
# Askpython.com, JournalDev.
# G V Datta Adithya
# Importing the module before utilization
import psutil
# Retrieving information regarding the CPU
## Returns the system CPU times as a named tuple
print(psutil.cpu_times())
@dat-adi
dat-adi / PermissionManagement.md
Created December 22, 2021 09:37
Notes taken on Permission Management in Linux.
View PermissionManagement.md

Introduction

Before we get started, it is important to execute a command that shows us what we are working with.

ls -l

Executing it on a system's home directory, with a particular file gives us the following response,

-rwxr-x-r-x 1 dat-adi users 2048 Dec 6 12:56 example.sh
@dat-adi
dat-adi / google-auth-test.py
Created January 23, 2021 10:30
Working with the `google-auth` module
View google-auth-test.py
import gspread
from google.oauth2 import service_account
from pprint import pprint
# used to retrieve credentials from the *creds.json* file
creds = service_account.Credentials.from_service_account_file("creds.json")
scoped_credentials = creds.with_scopes(
[
"https://spreadsheets.google.com/feeds",
'https://www.googleapis.com/auth/spreadsheets',
@dat-adi
dat-adi / heterogeneous_controller_station_migration.py
Created December 16, 2022 10:07
This script was made to emulate a station migration scenario, in a heterogeneous controller environment, using Mininet-Wifi.
View heterogeneous_controller_station_migration.py
#!/usr/bin/python
"""
This script is used to emulate a scenario where
a station migrates from one AP to another, while
attempting to ping a station from the third AP.
Controllers used to test: ODL, FL, Ryu.
Emulator used: Mininet-Wifi
Initial state
-------------
@dat-adi
dat-adi / heterogeneous_controller_triple_station_migration.py
Created December 16, 2022 10:10
A Mininet-Wifi emulation scenario where one station from every AP migrates to another AP, in a heterogeneous controller environment.
View heterogeneous_controller_triple_station_migration.py
#!/usr/bin/python
"""
This is a script that emulates a triple controller
heterogeneous environment, where mobile stations
migrate from one AP range to another.
"""
from mininet.node import Controller, RemoteController
from mininet.log import setLogLevel, info
from mn_wifi.net import Mininet_wifi
@dat-adi
dat-adi / markov_chain.py
Created December 16, 2022 10:14
A Markov Chain Implementation to create a controller priority list
View markov_chain.py
#!/usr/bin/python
"""
This is a program that implements the Markov Chain algorithm
to calculate the next best possible controller to contact for
executing the source and destination flow modification.
"""
import scipy.linalg
import numpy as np
@dat-adi
dat-adi / surround_me.py
Created December 16, 2022 10:15
A simple python script to calculate the coordinates to place nodes around a origin point.
View surround_me.py
#!/usr/bin/python
"""
This is a module used for setting coordinates for
networks.
"""
import math
def rotate(origin, point, angle):
@dat-adi
dat-adi / log_filer.py
Created December 16, 2022 10:23
Creates logs for APs in the network, in a temporary directory.
View log_filer.py
#!/usr/bin/python
"""
A script to write log files in the /tmp/migrationlogs
directory, and reports changes using the difference between
the current AP state and the log file state, to provide
stations that made it into the AP range.
This information can be used to provide new stations that
have entered the AP range.
"""