/
main.py
205 lines (189 loc) · 7.74 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
from datetime import datetime
from zoneinfo import ZoneInfo
import gifos
FONT_FILE_LOGO = "./fonts/vtks-blocketo.regular.ttf"
# FONT_FILE_BITMAP = "./fonts/ter-u14n.pil"
FONT_FILE_BITMAP = "./fonts/gohufont-uni-14.pil"
FONT_FILE_TRUETYPE = "./fonts/IosevkaTermNerdFont-Bold.ttf"
FONT_FILE_MONA = "./fonts/Inversionz.otf"
def main():
t = gifos.Terminal(800, 500, 15, 15, FONT_FILE_BITMAP, 15)
t.set_fps(15)
t.set_prompt("\x1b[0;91manas\x1b[0m@\x1b[0;93mlife ~> \x1b[0m")
# one God day is equal 1000 human year.
copyright_year = datetime.now().date().year / (1000 * 365.25)
t.gen_text("", 1, count=20)
t.toggle_show_cursor(False)
t.gen_text("OS Modular BIOS v1.0.25", 1)
t.gen_text(f"Copyright (C) {copyright_year}, \x1b[31mGod Inc.\x1b[0m", 2)
t.gen_text("\x1b[94mGitHub Profile ReadMe Terminal, Rev 1011\x1b[0m", 4)
t.gen_text("Krypton(tm) CPU - 250Hz", 6)
t.gen_text(
"Press \x1b[94mDEL\x1b[0m to enter SETUP, \x1b[94mESC\x1b[0m to cancel Memory Test",
t.num_rows,
)
for i in range(0, 65653, 7168): # 64K Memory
t.delete_row(7)
if i < 30000:
t.gen_text(
f"Memory Test: {i}", 7, count=2, contin=True
) # slow down upto a point
else:
t.gen_text(f"Memory Test: {i}", 7, contin=True)
t.delete_row(7)
t.gen_text("Memory Test: 64KB OK", 7, count=10, contin=True)
t.gen_text("", 11, count=10, contin=True)
t.clear_frame()
t.gen_text("Initiating Boot Sequence ", 1, contin=True)
t.gen_typing_text(".....", 1, contin=True)
t.gen_text("\x1b[96m", 1, count=0, contin=True) # buffer to be removed
t.set_font(FONT_FILE_LOGO, 66)
# t.toggle_show_cursor(True)
os_logo_text = "OS"
mid_row = (t.num_rows + 1) // 2
mid_col = (t.num_cols - len(os_logo_text) + 1) // 2
effect_lines = gifos.effects.text_scramble_effect_lines(
os_logo_text, 3, include_special=False
)
for i in range(len(effect_lines)):
t.delete_row(mid_row + 1)
t.gen_text(effect_lines[i], mid_row + 1, mid_col + 1)
t.set_font(FONT_FILE_BITMAP, 15)
t.clear_frame()
t.clone_frame(5)
t.toggle_show_cursor(False)
t.gen_text("\x1b[93mOS v1.0.25 (tty1)\x1b[0m", 1, count=5)
t.gen_text("login: ", 3, count=5)
t.toggle_show_cursor(True)
t.gen_typing_text("anas", 3, contin=True)
t.gen_text("", 4, count=5)
t.toggle_show_cursor(False)
t.gen_text("password: ", 4, count=5)
t.toggle_show_cursor(True)
t.gen_typing_text("*********", 4, contin=True)
t.toggle_show_cursor(False)
time_now = datetime.now(ZoneInfo("Africa/Cairo")).strftime(
"%a %b %d %I:%M:%S %p %Z %Y"
)
t.gen_text(f"Last login: {time_now} on tty1", 6)
t.gen_prompt(7, count=5)
prompt_col = t.curr_col
t.toggle_show_cursor(True)
t.gen_typing_text("\x1b[91mclea", 7, contin=True)
t.delete_row(7, prompt_col) # simulate syntax highlighting
t.gen_text("\x1b[92mclear\x1b[0m", 7, count=3, contin=True)
ignore_repos = ["dotfiles", "0x61nas.github.io", "obsidian"]
git_user_details = gifos.utils.fetch_github_stats("0x61nas", ignore_repos)
user_age = gifos.utils.calc_age(26, 3, 2003)
t.clear_frame()
top_languages = [lang[0] for lang in git_user_details.languages_sorted]
user_details_lines = f"""
\x1b[30;101m0x61nas@GitHub\x1b[0m
--------------
\x1b[96mOS: \x1b[93mArch Linux\x1b[0m
\x1b[96mHost: \x1b[93mThe Earth \x1b[94m#60.14 AU\x1b[0m
\x1b[96mKernel: \x1b[93mInformation Technology/Computer Science \x1b[94m#IT/CS\x1b[0m
\x1b[96mUptime: \x1b[93m{user_age.years} years, {user_age.months} months, {user_age.days} days\x1b[0m
\x1b[96mIDE: \x1b[93mHelix\x1b[0m
\x1b[30;101mContact:\x1b[0m
--------------
\x1b[96mEmail: \x1b[93m0x61nas@gmail.com\x1b[0m
\x1b[96mDiscord: \x1b[93m@0x61nas\x1b[0m
\x1b[30;101mGitHub Stats:\x1b[0m
--------------
\x1b[96mUser Rating: \x1b[93m{git_user_details.user_rank.level}\x1b[0m
\x1b[96mTotal Stars Earned: \x1b[93m{git_user_details.total_stargazers}\x1b[0m
\x1b[96mTotal Commits (2023): \x1b[93m{git_user_details.total_commits_last_year}\x1b[0m
\x1b[96mTotal PRs: \x1b[93m{git_user_details.total_pull_requests_made}\x1b[0m
\x1b[96mMerged PR %: \x1b[93m{git_user_details.pull_requests_merge_percentage}\x1b[0m
\x1b[96mTotal Contributions: \x1b[93m{git_user_details.total_repo_contributions}\x1b[0m
\x1b[96mTop Languages: \x1b[93m{', '.join(top_languages[:5])}\x1b[0m
"""
t.gen_prompt(1)
prompt_col = t.curr_col
t.clone_frame(10)
t.toggle_show_cursor(True)
t.gen_typing_text("\x1b[91mfetch.s", 1, contin=True)
t.delete_row(1, prompt_col)
t.gen_text("\x1b[92mfetch.sh\x1b[0m", 1, contin=True)
t.gen_typing_text(" -u 0x61nas", 1, contin=True)
t.set_font(FONT_FILE_MONA, 16, 0)
t.toggle_show_cursor(False)
monaLines = r"""
\x1b[49m \x1b[90;100m}}\x1b[49m \x1b[90;100m}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}\x1b[49m \x1b[90;100m}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}\x1b[49m \x1b[90;100m}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}}}}}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}}}}}}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}\x1b[37;47m}}}}}}}\x1b[90;100m}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}\x1b[37;47m}}}}}}}}}}\x1b[90;100m}}}\x1b[0m
\x1b[49m \x1b[90;100m}}\x1b[37;47m}\x1b[90;100m}\x1b[37;47m}}}}}\x1b[90;100m}\x1b[37;47m}}\x1b[90;100m}}}}\x1b[0m
\x1b[49m \x1b[90;100m}\x1b[37;47m}}\x1b[90;100m}\x1b[37;47m}}}}}\x1b[90;100m}\x1b[37;47m}}}\x1b[90;100m}}}\x1b[0m
\x1b[90;100m}}}\x1b[37;47m}}}}\x1b[90;100m}}}\x1b[37;47m}}}}}\x1b[90;100m}}}}\x1b[0m
\x1b[49m \x1b[90;100m}\x1b[37;47m}}}}}\x1b[90;100m}}\x1b[37;47m}}}}}\x1b[90;100m}}}\x1b[0m
\x1b[49m \x1b[90;100m}}\x1b[37;47m}}}}}}}}}}}}\x1b[90;100m}}}\x1b[0m
\x1b[90;100m}\x1b[49m \x1b[90;100m}}\x1b[37;47m}}}}}}}}\x1b[90;100m}}}\x1b[49m \x1b[90;100m}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}}}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}}}}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}\x1b[49m \x1b[90;100m}}}}}}\x1b[49m \x1b[90;100m}}\x1b[0m
\x1b[49m \x1b[90;100m}}}}}}}\x1b[0m
\x1b[49m \x1b[90;100m}}}\x1b[49m \x1b[90;100m}}\x1b[0m
"""
t.gen_text(monaLines, 10)
t.set_font(FONT_FILE_BITMAP)
t.toggle_show_cursor(True)
t.gen_text(user_details_lines, 2, 35, count=5, contin=True)
t.gen_prompt(t.curr_row)
prompt_col = t.curr_col
t.gen_typing_text(
"\x1b[91mdoa",
t.curr_row,
contin=True,
)
t.delete_row(t.curr_row, prompt_col)
t.gen_text(
"\x1b[92mdoas",
t.curr_row,
count=3,
contin=True,
)
t.gen_typing_text(
"\x1b[91m pkil\x1b[0m",
t.curr_row,
contin=True,
)
t.delete_row(t.curr_row, prompt_col)
t.gen_text(
"\x1b[92mdoas pkill\x1b[0m",
t.curr_row,
contin=True,
)
t.gen_typing_text("\x1b[91m -\x1b[0m", t.curr_row, contin=True)
t.delete_row(t.curr_row, prompt_col)
t.gen_text(
"\x1b[92mdoas pkill -f\x1b[0m",
t.curr_row,
contin=True,
)
t.gen_typing_text(
"\x1b[91m $(whoami\x1b[0m",
t.curr_row,
contin=True,
)
t.delete_row(t.curr_row, prompt_col)
t.gen_text(
"\x1b[92mdoas pkill -f $(whoami)\x1b[0m",
t.curr_row,
contin=True,
)
t.save_frame("screenshot.png")
t.gen_text("\x1b[31m doas: Authentication faild\x1b[0m", t.curr_row)
t.gen_prompt(t.curr_row)
t.gen_text("", t.curr_row, count=80, contin=True)
t.gen_gif()
if __name__ == "__main__":
main()