Skip to content

Instantly share code, notes, and snippets.

Sujayyendhiren Ramarao srinivasamurthi sujayy1983

View GitHub Profile
View skeleton-argparse-pickle.py
"""
Description:
This application maybe imported or used as a command line interface.
A skeleton that ll interact with REST API, xml-rpc, cli and other possible interfaces of network devices.
Mappings: It pickles data mappings locally in the 'mapping' folder.
Configurations: All the configurations are read locally from 'confs' - TODO
Logs: All logs are stored and rotated from the folder 'logs' - TODO
Before starting this app. Create a directory tree structure as following:
View NoviceLearningBootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<title>Home Automation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
View get_username.py
"""
Description: Get current username. Useful in automation.
"""
#Approach1
import os
import pwd
pwd.getpwuid( os.getuid() ).pw_name
#Approach2
View ReferenceJS.py
@app.route("/tableCreate")
def create_table():
return """
<html>
<head>
<link rel= "stylesheet" type= "text/css" href= "/static/style.css">
</head>
<body>
<form action="http://192.168.0.2:5000/form" method="post">
View dataframe_plots_beginner.py
"""
Description:
An attempt to create plots from csv dataset.
Sample csv auto generation script:
import math
file = open("Dataset.csv", 'w')
file.write( "Linear,AP,GP,EXP,ACTION\n")
View pandas_to_html_flask.py
'''
Description:
Using pandas display 200 lines of csv at a time. Csv for example could be an import from a database.
'''
"""
If you plan to test this with a sample csv then you may use the following code to generate csv:
file = open("large.csv", "w")
View sample_df_pandas.py
__author__= "Sujayyendhiren Srinivasamurthi"
__email__ = "sujayyendhiren.srinivasamurthi@fmr.com"
__description__ = """
Manipulating dataframes, especially adding row to a dataframe.
"""
import numpy as np
import pandas as pd
df = pd.DataFrame(columns=['Apps', 'Data'])
View js_unuser_var_finder.py
__author__ = 'Sujayyendhiren Srinivasamurthi'
__email__ = 'sujayy1983@gmail.com'
__description__ = '''Javascript unused variable checker.
Tested with a simple PAC file too.'''
import os
dupvariables = {}
def parserfunction( js_file ):
@sujayy1983
sujayy1983 / DemoAnsible.py
Created Mar 29, 2015
+ System information and interface information. + This demo script is to obtain target information. + Any remote execution client can deploy this script and obtain info.
View DemoAnsible.py
__author__='''Sujayyendhiren Srinivasamurthi'''
___email__='''sujayy1983@gmail.com'''
__description__= '''Demo script. Obtain target host's system information. '''
import platform
import logging
import netifaces
import socket
import json
import re
@sujayy1983
sujayy1983 / Radix.py
Last active Aug 29, 2015
Radix sorting: A non-comparitive sorting
View Radix.py
"""
@Author: Sujayyendhiren Ramarao Srinivasamurthi
@Description: Radix sort my own way.
"""
def radixsort( inArr ):
"""
:param inArr: Input array for sorting
:return: Result is a dict of arrays indexable from 0-9.
"""
You can’t perform that action at this time.