Skip to content

Instantly share code, notes, and snippets.

View sujayy1983's full-sized avatar

Sujayyendhiren Ramarao srinivasamurthi sujayy1983

View GitHub Profile
@sujayy1983
sujayy1983 / VarArgument.py
Created January 26, 2015 00:07
Fun with *args and **kwargs
"""
@Author: Sujayyendhiren Ramarao Srinivasamurthi
@Description: Fun with args and kwargs
"""
def function1 ( *args, ** kwargs):
print ""
print args
print kwargs
"""
@Author: Sujayyendhiren Ramarao srinivasamurthi
@Description: Scalar product Reference data and code used from
http://www.python-course.eu/matrix_arithmetic.php
"""
import numpy as np
#Dot product
x = np.array( [1, 2, 3])
y = np.array( [-7, 8, 9])
@sujayy1983
sujayy1983 / Selection.py
Created January 29, 2015 23:41
Implementation of selection sort.
"""
@Author: Sujayyendhiren Ramarao Srinivasamurthi
@Description: Selection sort
"""
def selection_sort( arr2sort ):
for idx in range(len(arr2sort)):
min = idx
@sujayy1983
sujayy1983 / Bubble.py
Created January 29, 2015 23:41
Implementation of bubble sort
"""
@Author: Sujayyendhiren Ramarao Srinivasamurthi
@Description: Bubble sort implementation
"""
def bubble_sor( arr2Sort ):
for x in range(len(arr2Sort)):
sortCnt = 0
for idx in range( len(arr2Sort) - x - 1):
if (arr2Sort[idx] > arr2Sort[idx+1]):
@sujayy1983
sujayy1983 / GraphTraversal.py
Last active August 29, 2015 14:14
Traverse unidirectional graph. DFS another example.
"""
@Author: Sujayyendhiren
@Description: Depth first search
"""
def backtrack( visitedParent, start, end ):
result = []
node = end
result.insert(0,end)
@sujayy1983
sujayy1983 / CreateBTfromSortedArray.py
Created January 30, 2015 16:36
create balanced tree for a sorted array.
"""
@Author: Sujayyendhiren
@Description: Sorted array for binary tree construction
"""
class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
@sujayy1983
sujayy1983 / toolIntegrator.py
Last active August 29, 2015 14:14
A tool to integrate various attack tools. Example: Slowloris, RUDY, Tor's hammer etc.A sample work which maynot be enough all by itself. But just a glimpse of the attempt.
#--------------------------------------------------------------------------------#
# 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
@sujayy1983
sujayy1983 / Goldeneye.py
Created January 31, 2015 01:41
Such files need to be created to integrate with toolintegrator.py. This framework maybe extended to integrate multiple client tools into a single GUI application.
#--------------------------------------------------------------------------------#
# 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
@sujayy1983
sujayy1983 / Regular-Expressions.py
Created January 31, 2015 14:24
Examples of Regular expression. Combined examples from across the internet and some of them are modified to explore different behaviors.
import re
"""
http://www.diveinto.org/python3/regular-expressions.html
"""
"""
Example 1:
Important points: Use raw string 'r' and \b tells the word boundary
"""
@sujayy1983
sujayy1983 / magic-call.py
Created January 31, 2015 14:30
Using magic function __call__()
"""
@Author: Sujayyendhiren Ramarao Srinivasamurthi
@Description: An Example of magic function __call__()
"""
class testCls:
def __init__(self):
self.a = 5
def __call__(self, *args, **kwargs):