Skip to content

Commit 67c985b

Browse files
authored
Merge branch 'geekcomputers:master' into master
2 parents d70116c + 665bc40 commit 67c985b

33 files changed

+762
-153
lines changed

Assembler/GUIDE.txt

+10-10
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ int 0x80
2727

2828
```
2929

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

3636
**Important: close each line with a newline!**
@@ -67,7 +67,7 @@ int 0x80
6767

6868
```
6969

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

7373

@@ -79,20 +79,20 @@ Result of code, above.
7979

8080
### Comments available
8181

82-
Comments begin with ; and ends with a newline.
83-
We noticed a comment, above.
82+
Comments begin with ; and end with a newline.
83+
We noticed a comment above.
8484

8585
### Push and Pop
8686

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

9090
```
9191
push eax
9292

9393
```
9494

95-
This line will push the content of register eax onto the stack.
95+
This line will push the contents of register eax onto the stack.
9696

9797
```
9898
pop ecx
@@ -109,7 +109,7 @@ pop [register]
109109

110110
### Jumps
111111

112-
With the command **cmp** we can compare two register.
112+
With the command **cmp** we can compare two registers.
113113

114114
```
115115
cmp r0, r1
@@ -119,7 +119,7 @@ jmp l2
119119
```
120120

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

124124
#### Labels
125125

BlackJack_game/blackjack.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# master
22
# master
33
# BLACK JACK - CASINO A GAME OF FORTUNE!!!
4-
from time import *
4+
from time import sleep
55

66
# BLACK JACK - CASINO
77
# PYTHON CODE BASE
@@ -118,4 +118,4 @@ def dealer_choice():
118118

119119
else:
120120
dealer_choice()
121-
break
121+
break

BrowserHistory/backend.py

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
class DLL:
2+
"""
3+
a doubly linked list that holds the current page,
4+
next page, and previous page.
5+
Used to enforce order in operations
6+
"""
7+
def __init__(self, val: str =None):
8+
self.val = val
9+
self.nxt = None
10+
self.prev = None
11+
12+
13+
class BrowserHistory:
14+
"""
15+
This class designs the operations of a browser history
16+
17+
It works by using a doubly linked list to hold the urls
18+
"""
19+
20+
def __init__(self, homepage: str):
21+
"""
22+
Returns - None
23+
Input - None
24+
----------
25+
- Initialize doubly linked list which will serve as the
26+
browser history and sets the current page
27+
"""
28+
self.head = DLL(homepage)
29+
self.curr = self.head
30+
31+
def visit(self, url: str) -> None:
32+
"""
33+
Returns - None
34+
Input - str
35+
----------
36+
- Adds the current url to the DLL
37+
- sets both the next and previous values
38+
"""
39+
url_node = DLL(url)
40+
self.curr.nxt = url_node
41+
url_node.prev = self.curr
42+
43+
self.curr = url_node
44+
45+
46+
def back(self, steps: int) -> str:
47+
"""
48+
Returns - str
49+
Input - int
50+
----------
51+
- Iterates through the DLL backwards `step` number of times
52+
- returns the appropriate value
53+
"""
54+
while steps > 0 and self.curr.prev:
55+
self.curr = self.curr.prev
56+
steps -= 1
57+
return self.curr.val
58+
59+
60+
def forward(self, steps: int) -> str:
61+
"""
62+
Returns - str
63+
Input - int
64+
----------
65+
- Iterates through the DLL forewards `step` number of times
66+
- returns the appropriate value
67+
"""
68+
while steps > 0 and self.curr.nxt:
69+
self.curr = self.curr.nxt
70+
steps -= 1
71+
return self.curr.val
72+
73+
74+
if __name__ == "__main__":
75+
obj = BrowserHistory("google.com")
76+
obj.visit("twitter.com")
77+
param_2 = obj.back(1)
78+
param_3 = obj.forward(1)
79+
80+
print(param_2)
81+
print(param_3)

Calculate resistance.py

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
def res(R1, R2):
2-
sum = R1 + R2
3-
if (option =="series"):
4-
return sum
5-
else:
6-
return (R1 * R2)/(R1 + R2)
7-
Resistance1 = int(input("Enter R1 : "))
8-
Resistance2 = int(input("Enter R2 : "))
9-
option = str(input("Enter series or parallel :"))
10-
print("\n")
11-
R = res(Resistance1,Resistance2 )
12-
print("The total resistance is", R)
1+
def res(R1, R2):
2+
sum = R1 + R2
3+
if option =="series":
4+
return sum
5+
elif option =="parallel" :
6+
return (R1 * R2)/sum
7+
return 0
8+
Resistance1 = int(input("Enter R1 : "))
9+
Resistance2 = int(input("Enter R2 : "))
10+
option = input("Enter series or parallel :")
11+
print("\n")
12+
R = res(Resistance1,Resistance2 )
13+
if R==0:
14+
print('Wrong Input!!' )
15+
else:
16+
print("The total resistance is", R)

CliYoutubeDownloader/CliYoutubeDownloader.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class YouTubeDownloder:
88
def __init__(self):
9-
self.url = str(input("Enter the url of video : "))
9+
self.url = str(input("Enter the URL of video : "))
1010
self.youtube = pytube.YouTube(
1111
self.url, on_progress_callback=YouTubeDownloder.onProgress
1212
)
@@ -28,14 +28,14 @@ def showStreams(self):
2828
self.chooseStream()
2929

3030
def chooseStream(self):
31-
self.choose = int(input("please select one : "))
31+
self.choose = int(input("Please select one : "))
3232
self.validateChooseValue()
3333

3434
def validateChooseValue(self):
3535
if self.choose in range(1, self.streamNo):
3636
self.getStream()
3737
else:
38-
print("please enter a correct option on the list.")
38+
print("Please enter a correct option on the list.")
3939
self.chooseStream()
4040

4141
def getStream(self):
@@ -49,15 +49,15 @@ def getFileSize(self):
4949

5050
def getPermisionToContinue(self):
5151
print(
52-
"\n title : {0} \n author : {1} \n size : {2:.2f}MB \n resolution : {3} \n fps : {4} \n ".format(
52+
"\n Title : {0} \n Author : {1} \n Size : {2:.2f}MB \n Resolution : {3} \n FPS : {4} \n ".format(
5353
self.youtube.title,
5454
self.youtube.author,
5555
file_size,
5656
self.stream.resolution,
5757
self.stream.fps,
5858
)
5959
)
60-
if input("do you want it ?(defualt = (y)es) or (n)o ") == "n":
60+
if input("Do you want it ?(default = (y)es) or (n)o ") == "n":
6161
self.showStreams()
6262
else:
6363
self.main()
@@ -69,7 +69,7 @@ def download(self):
6969
def onProgress(stream=None, chunk=None, remaining=None):
7070
file_downloaded = file_size - (remaining / 1000000)
7171
print(
72-
f"downloading ... {file_downloaded/file_size*100:0.2f} % [{file_downloaded:.1f}MB of {file_size:.1f}MB]",
72+
f"Downloading ... {file_downloaded/file_size*100:0.2f} % [{file_downloaded:.1f}MB of {file_size:.1f}MB]",
7373
end="\r",
7474
)
7575

Colors/pixel_sort.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def createDataSet(val=0, data=[]):
4343
# Generating colors for each row of the frame
4444
def generateColors(c_sorted, frame, row):
4545
global df, img_list
46-
height = 25
46+
height = 15
4747
img = np.zeros((height, len(c_sorted), 3), np.uint8)
4848
for x in range(0, len(c_sorted)):
4949
r, g, b = c_sorted[x][0] * 255, c_sorted[x][1] * 255, c_sorted[x][2] * 255
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
numpy==2.0.0
2-
opencv_python==4.10.0.82
3-
mediapipe==0.10.14
1+
numpy==2.1.3
2+
opencv_python==4.10.0.84
3+
mediapipe==0.10.18

News_App/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
solara == 1.32.2
1+
solara == 1.40.0
22
Flask
3-
gunicorn ==22.0.0
3+
gunicorn ==23.0.0
44
simple-websocket
55
flask-sock
66
yfinance

PDF/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Pillow==10.3.0
1+
Pillow==11.0.0
22
fpdf==1.7.2

Password Generator/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
colorama==0.4.6
2-
inquirer==3.2.5
2+
inquirer==3.4.0

Patterns/half triangle pattern.py

+16-28
Original file line numberDiff line numberDiff line change
@@ -40,43 +40,31 @@ def main():
4040
print("Invalid input")
4141
exit(0)
4242

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

45-
t = 1
46-
for column in range(1, (lines +1)):
47-
print(f"{str(t) * column}")
48-
t += 1
4947

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

52-
for column in range(1, (lines +1)):
53-
row = ""
54-
for ii in range(1, column +1):
55-
row += str(ii)
56-
print(row)
57-
5852

59-
def lower_half_incremental_pattern(lines):
53+
def upper_half_incremental_pattern(lines=5):
54+
const=""
55+
for column in range(1, (lines +1)):
56+
const+=str(column)
57+
print(const)
6058

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

65-
for _ in range(row_length):
66-
column = 0 if column == 10 else column
67-
row = f"{row}{column}"
68-
column += 1
6960

70-
print(row)
61+
def lower_half_incremental_pattern(lines=5):
62+
for row_length in range(lines, 0, -1):
63+
for x in range(1,row_length+1):
64+
print(x,end='')
65+
print()
7166

72-
def lower_half_repeat_pattern(lines):
7367

74-
for row_length in range(lines, 0, -1):
75-
76-
row = ""
77-
for _ in range(1, row_length+1):
78-
row += str(row_length)
79-
print(row)
8068

8169
if __name__ == "__main__":
8270
main()

Patterns/pattern2.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ def main():
1313
pattern(lines)
1414

1515
def pattern(lines):
16-
for i in range(lines,0,-1):
17-
for j in range(lines-i):
18-
print(' ', end='')
19-
20-
for j in range(2*i-1):
21-
print('$',end='')
22-
print()
23-
16+
flag=lines
17+
for i in range(lines):
18+
print(" "*(i),'$'*(2*flag-1))
19+
flag-=1
2420

2521
if __name__ == "__main__":
2622
main()

Patterns/pattern5.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ def main():
99
lines = int(input("Enter the number of lines: "))
1010
pattern(lines)
1111

12-
def pattern(rows):
13-
for i in range(1, rows+1):
14-
for j in range(i, 0, -1):
15-
print(j, end="")
16-
print()
12+
def pattern(rows):
13+
const=''
14+
for i in range(1, rows+1):
15+
const=str(i)+const
16+
print(const)
1717

1818
if __name__ == "__main__":
1919
main()

0 commit comments

Comments
 (0)