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
__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 |
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
""" | |
@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. | |
""" |
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
""" | |
@Author: Sujayyendhiren Ramarao Srinivasamurthi | |
@Description: - Build a sample binary tree | |
- List of lists where each list has elements at a particular depth | |
""" | |
#Build balanced/unbalanced binary tree for experiment | |
#Build list of lists | |
class Node(): |
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
""" | |
@Author: Sujayyendhiren Ramarao Srinivasamurthi | |
@Description: Permutations of given string | |
""" | |
import re | |
def insert ( word, idx, char ): | |
first = word[0:idx] | |
last = word[idx:len(word)] | |
return first + char + last |
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
""" | |
@Author: Sujayyendhiren | |
@Description: Exponential problems are easyily memoized in Python. | |
""" | |
def stairsUp( countN , dictCalculations): | |
if( countN < 0): | |
return 0 | |
elif (countN == 0 ): |
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
""" | |
@Author: Sujayyendhiren Ramarao srinivasamurthi | |
@Description: GCD of numbers the Euclidean way | |
""" | |
def gcd_calculate( first , second ): | |
if( first > second ): | |
#Swap values | |
first , second = second, first |
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
""" | |
@Author: Sujayyendhiren Ramarao Srinivasamurthi | |
@Description: An Example of magic function __call__() | |
""" | |
class testCls: | |
def __init__(self): | |
self.a = 5 | |
def __call__(self, *args, **kwargs): |
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
import re | |
""" | |
http://www.diveinto.org/python3/regular-expressions.html | |
""" | |
""" | |
Example 1: | |
Important points: Use raw string 'r' and \b tells the word boundary | |
""" |
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
#--------------------------------------------------------------------------------# | |
# Author: Sujayyendhiren Ramarao Srinivasamurthi # | |
# Email: sujayy1983@gmail.com # | |
# Book for wxPython: 'wxPython in Action' Noel Rappin and Robin Dunn # | |
#--------------------------------------------------------------------------------# | |
import wx | |
import random | |
import os | |
import Description |
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
#--------------------------------------------------------------------------------# | |
# Author: Sujayyendhiren Ramarao Srinivasamurthi # | |
# Email: sujayy1983@gmail.com # | |
# Book for wxPython: 'wxPython in Action' Noel Rappin and Robin Dunn # | |
#--------------------------------------------------------------------------------# | |
import wx | |
import random | |
import TorsHammer | |
import Goldeneye |