Skip to content

Instantly share code, notes, and snippets.

View sujayy1983's full-sized avatar

Sujayyendhiren Ramarao srinivasamurthi sujayy1983

View GitHub Profile
""
Description : Hide data behind steganography
Library : https://github.com/computationalcore/cryptosteganography
"""
import sys
import json
from getpass import getpass
from cryptosteganography import CryptoSteganography
"""
Description: Rotate encryption key to keep sensitive data more secure
1. Read 'secret key' and decrypt the 'secret file'.
2. Generate new 'secret key' and encrypt the 'secret file' with new key and store it back to the 'secret file'.
3. Update new 'secret key' into the hidden file.
"""
import os
import sys
import yaml
"""
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:
<!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>
"""
Description: Get current username. Useful in automation.
"""
#Approach1
import os
import pwd
pwd.getpwuid( os.getuid() ).pw_name
#Approach2
@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">
"""
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")
'''
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")
__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'])
__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 ):