Skip to content

Commit

Permalink
Merge branch 'geekcomputers:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
BhanuSaketh authored Nov 16, 2024
2 parents d70116c + 665bc40 commit 67c985b
Show file tree
Hide file tree
Showing 33 changed files with 762 additions and 153 deletions.
20 changes: 10 additions & 10 deletions Assembler/GUIDE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ int 0x80

```

* The first line move the number 56 into register ecx.
* The second line subtract 10 from the ecx register.
* The first line move the number 56 into register ecx.
* The second line subtracts 10 from the ecx register.
* The third line move the number 4 into the eax register. This is for the print-function.
* The fourt line call interrupt 0x80, thus the result will print onto console.
* The fourth line call interrupt 0x80, thus the result will print onto console.
* The fifth line is a new line. This is important.

**Important: close each line with a newline!**
Expand Down Expand Up @@ -67,7 +67,7 @@ int 0x80

```

**Important: The arithmetic commands (add, sub) works only with registers or constans.
**Important: The arithmetic commands (add, sub) work only with registers or constants.
Therefore we must use the register ebx as a placeholder, above.**


Expand All @@ -79,20 +79,20 @@ Result of code, above.

### Comments available

Comments begin with ; and ends with a newline.
We noticed a comment, above.
Comments begin with ; and end with a newline.
We noticed a comment above.

### Push and Pop

Sometimes we must save the content of a register, against losing of data.
Sometimes we must save the content of a register, against losing data.
Therefor we use the push and pop command.

```
push eax

```

This line will push the content of register eax onto the stack.
This line will push the contents of register eax onto the stack.

```
pop ecx
Expand All @@ -109,7 +109,7 @@ pop [register]

### Jumps

With the command **cmp** we can compare two register.
With the command **cmp** we can compare two registers.

```
cmp r0, r1
Expand All @@ -119,7 +119,7 @@ jmp l2
```

Are the two register equal? The the command **je** is actively and jumps to label **l1**
Otherwise the command **jmp** is actively and jumps to label **l2**
Otherwise, the command **jmp** is actively and jumps to label **l2**

#### Labels

Expand Down
4 changes: 2 additions & 2 deletions BlackJack_game/blackjack.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# master
# master
# BLACK JACK - CASINO A GAME OF FORTUNE!!!
from time import *
from time import sleep

# BLACK JACK - CASINO
# PYTHON CODE BASE
Expand Down Expand Up @@ -118,4 +118,4 @@ def dealer_choice():

else:
dealer_choice()
break
break
81 changes: 81 additions & 0 deletions BrowserHistory/backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
class DLL:
"""
a doubly linked list that holds the current page,
next page, and previous page.
Used to enforce order in operations
"""
def __init__(self, val: str =None):
self.val = val
self.nxt = None
self.prev = None


class BrowserHistory:
"""
This class designs the operations of a browser history
It works by using a doubly linked list to hold the urls
"""

def __init__(self, homepage: str):
"""
Returns - None
Input - None
----------
- Initialize doubly linked list which will serve as the
browser history and sets the current page
"""
self.head = DLL(homepage)
self.curr = self.head

def visit(self, url: str) -> None:
"""
Returns - None
Input - str
----------
- Adds the current url to the DLL
- sets both the next and previous values
"""
url_node = DLL(url)
self.curr.nxt = url_node
url_node.prev = self.curr

self.curr = url_node


def back(self, steps: int) -> str:
"""
Returns - str
Input - int
----------
- Iterates through the DLL backwards `step` number of times
- returns the appropriate value
"""
while steps > 0 and self.curr.prev:
self.curr = self.curr.prev
steps -= 1
return self.curr.val


def forward(self, steps: int) -> str:
"""
Returns - str
Input - int
----------
- Iterates through the DLL forewards `step` number of times
- returns the appropriate value
"""
while steps > 0 and self.curr.nxt:
self.curr = self.curr.nxt
steps -= 1
return self.curr.val


if __name__ == "__main__":
obj = BrowserHistory("google.com")
obj.visit("twitter.com")
param_2 = obj.back(1)
param_3 = obj.forward(1)

print(param_2)
print(param_3)
28 changes: 16 additions & 12 deletions Calculate resistance.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
def res(R1, R2):
sum = R1 + R2
if (option =="series"):
return sum
else:
return (R1 * R2)/(R1 + R2)
Resistance1 = int(input("Enter R1 : "))
Resistance2 = int(input("Enter R2 : "))
option = str(input("Enter series or parallel :"))
print("\n")
R = res(Resistance1,Resistance2 )
print("The total resistance is", R)
def res(R1, R2):
sum = R1 + R2
if option =="series":
return sum
elif option =="parallel" :
return (R1 * R2)/sum
return 0
Resistance1 = int(input("Enter R1 : "))
Resistance2 = int(input("Enter R2 : "))
option = input("Enter series or parallel :")
print("\n")
R = res(Resistance1,Resistance2 )
if R==0:
print('Wrong Input!!' )
else:
print("The total resistance is", R)
12 changes: 6 additions & 6 deletions CliYoutubeDownloader/CliYoutubeDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class YouTubeDownloder:
def __init__(self):
self.url = str(input("Enter the url of video : "))
self.url = str(input("Enter the URL of video : "))
self.youtube = pytube.YouTube(
self.url, on_progress_callback=YouTubeDownloder.onProgress
)
Expand All @@ -28,14 +28,14 @@ def showStreams(self):
self.chooseStream()

def chooseStream(self):
self.choose = int(input("please select one : "))
self.choose = int(input("Please select one : "))
self.validateChooseValue()

def validateChooseValue(self):
if self.choose in range(1, self.streamNo):
self.getStream()
else:
print("please enter a correct option on the list.")
print("Please enter a correct option on the list.")
self.chooseStream()

def getStream(self):
Expand All @@ -49,15 +49,15 @@ def getFileSize(self):

def getPermisionToContinue(self):
print(
"\n title : {0} \n author : {1} \n size : {2:.2f}MB \n resolution : {3} \n fps : {4} \n ".format(
"\n Title : {0} \n Author : {1} \n Size : {2:.2f}MB \n Resolution : {3} \n FPS : {4} \n ".format(
self.youtube.title,
self.youtube.author,
file_size,
self.stream.resolution,
self.stream.fps,
)
)
if input("do you want it ?(defualt = (y)es) or (n)o ") == "n":
if input("Do you want it ?(default = (y)es) or (n)o ") == "n":
self.showStreams()
else:
self.main()
Expand All @@ -69,7 +69,7 @@ def download(self):
def onProgress(stream=None, chunk=None, remaining=None):
file_downloaded = file_size - (remaining / 1000000)
print(
f"downloading ... {file_downloaded/file_size*100:0.2f} % [{file_downloaded:.1f}MB of {file_size:.1f}MB]",
f"Downloading ... {file_downloaded/file_size*100:0.2f} % [{file_downloaded:.1f}MB of {file_size:.1f}MB]",
end="\r",
)

Expand Down
2 changes: 1 addition & 1 deletion Colors/pixel_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def createDataSet(val=0, data=[]):
# Generating colors for each row of the frame
def generateColors(c_sorted, frame, row):
global df, img_list
height = 25
height = 15
img = np.zeros((height, len(c_sorted), 3), np.uint8)
for x in range(0, len(c_sorted)):
r, g, b = c_sorted[x][0] * 255, c_sorted[x][1] * 255, c_sorted[x][2] * 255
Expand Down
6 changes: 3 additions & 3 deletions Hand-Motion-Detection/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
numpy==2.0.0
opencv_python==4.10.0.82
mediapipe==0.10.14
numpy==2.1.3
opencv_python==4.10.0.84
mediapipe==0.10.18
4 changes: 2 additions & 2 deletions News_App/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
solara == 1.32.2
solara == 1.40.0
Flask
gunicorn ==22.0.0
gunicorn ==23.0.0
simple-websocket
flask-sock
yfinance
2 changes: 1 addition & 1 deletion PDF/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Pillow==10.3.0
Pillow==11.0.0
fpdf==1.7.2
2 changes: 1 addition & 1 deletion Password Generator/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
colorama==0.4.6
inquirer==3.2.5
inquirer==3.4.0
44 changes: 16 additions & 28 deletions Patterns/half triangle pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,43 +40,31 @@ def main():
print("Invalid input")
exit(0)

def upper_half_repeat_pattern(lines):
def upper_half_repeat_pattern(lines=5):
for column in range(1, (lines +1)):
print(f"{str(column) * column}")

t = 1
for column in range(1, (lines +1)):
print(f"{str(t) * column}")
t += 1

def upper_half_incremental_pattern(lines):
def lower_half_repeat_pattern(lines=5):
for length in range(lines, 0, -1):
print(f"{str(length) * length}")

for column in range(1, (lines +1)):
row = ""
for ii in range(1, column +1):
row += str(ii)
print(row)


def lower_half_incremental_pattern(lines):
def upper_half_incremental_pattern(lines=5):
const=""
for column in range(1, (lines +1)):
const+=str(column)
print(const)

for row_length in range(lines, 0, -1):
row = ""
column = 1

for _ in range(row_length):
column = 0 if column == 10 else column
row = f"{row}{column}"
column += 1

print(row)
def lower_half_incremental_pattern(lines=5):
for row_length in range(lines, 0, -1):
for x in range(1,row_length+1):
print(x,end='')
print()

def lower_half_repeat_pattern(lines):

for row_length in range(lines, 0, -1):

row = ""
for _ in range(1, row_length+1):
row += str(row_length)
print(row)

if __name__ == "__main__":
main()
12 changes: 4 additions & 8 deletions Patterns/pattern2.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ def main():
pattern(lines)

def pattern(lines):
for i in range(lines,0,-1):
for j in range(lines-i):
print(' ', end='')

for j in range(2*i-1):
print('$',end='')
print()

flag=lines
for i in range(lines):
print(" "*(i),'$'*(2*flag-1))
flag-=1

if __name__ == "__main__":
main()
Expand Down
10 changes: 5 additions & 5 deletions Patterns/pattern5.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def main():
lines = int(input("Enter the number of lines: "))
pattern(lines)

def pattern(rows):
for i in range(1, rows+1):
for j in range(i, 0, -1):
print(j, end="")
print()
def pattern(rows):
const=''
for i in range(1, rows+1):
const=str(i)+const
print(const)

if __name__ == "__main__":
main()
Loading

0 comments on commit 67c985b

Please sign in to comment.