Skip to content

Commit d7ff573

Browse files
committed
hi
1 parent f8dfb60 commit d7ff573

File tree

159 files changed

+6327
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+6327
-0
lines changed

_MISC/Experiments/tetris.js

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
// stats.js r6 - http://github.com/mrdoob/stats.js
2+
var Stats = function () {
3+
function s(a, g, d) {
4+
var f, c, e;
5+
for (c = 0; c < 30; c++)
6+
for (f = 0; f < 73; f++)
7+
(e = (f + c * 74) * 4),
8+
(a[e] = a[e + 4]),
9+
(a[e + 1] = a[e + 5]),
10+
(a[e + 2] = a[e + 6]);
11+
for (c = 0; c < 30; c++)
12+
(e = (73 + c * 74) * 4),
13+
c < g
14+
? ((a[e] = b[d].bg.r), (a[e + 1] = b[d].bg.g), (a[e + 2] = b[d].bg.b))
15+
: ((a[e] = b[d].fg.r),
16+
(a[e + 1] = b[d].fg.g),
17+
(a[e + 2] = b[d].fg.b));
18+
}
19+
var r = 0,
20+
t = 2,
21+
g,
22+
u = 0,
23+
j = new Date().getTime(),
24+
F = j,
25+
v = j,
26+
l = 0,
27+
w = 1e3,
28+
x = 0,
29+
k,
30+
d,
31+
a,
32+
m,
33+
y,
34+
n = 0,
35+
z = 1e3,
36+
A = 0,
37+
f,
38+
c,
39+
o,
40+
B,
41+
p = 0,
42+
C = 1e3,
43+
D = 0,
44+
h,
45+
i,
46+
q,
47+
E,
48+
b = {
49+
fps: { bg: { r: 16, g: 16, b: 48 }, fg: { r: 0, g: 255, b: 255 } },
50+
ms: { bg: { r: 16, g: 48, b: 16 }, fg: { r: 0, g: 255, b: 0 } },
51+
mb: { bg: { r: 48, g: 16, b: 26 }, fg: { r: 255, g: 0, b: 128 } },
52+
};
53+
g = document.createElement('div');
54+
g.style.cursor = 'pointer';
55+
g.style.width = '80px';
56+
g.style.opacity = '0.9';
57+
g.style.zIndex = '10001';
58+
g.addEventListener(
59+
'click',
60+
function () {
61+
r++;
62+
r == t && (r = 0);
63+
k.style.display = 'none';
64+
f.style.display = 'none';
65+
h.style.display = 'none';
66+
switch (r) {
67+
case 0:
68+
k.style.display = 'block';
69+
break;
70+
case 1:
71+
f.style.display = 'block';
72+
break;
73+
case 2:
74+
h.style.display = 'block';
75+
}
76+
},
77+
!1
78+
);
79+
k = document.createElement('div');
80+
k.style.backgroundColor =
81+
'rgb(' +
82+
Math.floor(b.fps.bg.r / 2) +
83+
',' +
84+
Math.floor(b.fps.bg.g / 2) +
85+
',' +
86+
Math.floor(b.fps.bg.b / 2) +
87+
')';
88+
k.style.padding = '2px 0px 3px 0px';
89+
g.appendChild(k);
90+
d = document.createElement('div');
91+
d.style.fontFamily = 'Helvetica, Arial, sans-serif';
92+
d.style.textAlign = 'left';
93+
d.style.fontSize = '9px';
94+
d.style.color =
95+
'rgb(' + b.fps.fg.r + ',' + b.fps.fg.g + ',' + b.fps.fg.b + ')';
96+
d.style.margin = '0px 0px 1px 3px';
97+
d.innerHTML = '<span style="font-weight:bold">FPS</span>';
98+
k.appendChild(d);
99+
a = document.createElement('canvas');
100+
a.width = 74;
101+
a.height = 30;
102+
a.style.display = 'block';
103+
a.style.marginLeft = '3px';
104+
k.appendChild(a);
105+
m = a.getContext('2d');
106+
m.fillStyle = 'rgb(' + b.fps.bg.r + ',' + b.fps.bg.g + ',' + b.fps.bg.b + ')';
107+
m.fillRect(0, 0, a.width, a.height);
108+
y = m.getImageData(0, 0, a.width, a.height);
109+
f = document.createElement('div');
110+
f.style.backgroundColor =
111+
'rgb(' +
112+
Math.floor(b.ms.bg.r / 2) +
113+
',' +
114+
Math.floor(b.ms.bg.g / 2) +
115+
',' +
116+
Math.floor(b.ms.bg.b / 2) +
117+
')';
118+
f.style.padding = '2px 0px 3px 0px';
119+
f.style.display = 'none';
120+
g.appendChild(f);
121+
c = document.createElement('div');
122+
c.style.fontFamily = 'Helvetica, Arial, sans-serif';
123+
c.style.textAlign = 'left';
124+
c.style.fontSize = '9px';
125+
c.style.color = 'rgb(' + b.ms.fg.r + ',' + b.ms.fg.g + ',' + b.ms.fg.b + ')';
126+
c.style.margin = '0px 0px 1px 3px';
127+
c.innerHTML = '<span style="font-weight:bold">MS</span>';
128+
f.appendChild(c);
129+
a = document.createElement('canvas');
130+
a.width = 74;
131+
a.height = 30;
132+
a.style.display = 'block';
133+
a.style.marginLeft = '3px';
134+
f.appendChild(a);
135+
o = a.getContext('2d');
136+
o.fillStyle = 'rgb(' + b.ms.bg.r + ',' + b.ms.bg.g + ',' + b.ms.bg.b + ')';
137+
o.fillRect(0, 0, a.width, a.height);
138+
B = o.getImageData(0, 0, a.width, a.height);
139+
try {
140+
performance &&
141+
performance.memory &&
142+
performance.memory.totalJSHeapSize &&
143+
(t = 3);
144+
} catch (G) {}
145+
h = document.createElement('div');
146+
h.style.backgroundColor =
147+
'rgb(' +
148+
Math.floor(b.mb.bg.r / 2) +
149+
',' +
150+
Math.floor(b.mb.bg.g / 2) +
151+
',' +
152+
Math.floor(b.mb.bg.b / 2) +
153+
')';
154+
h.style.padding = '2px 0px 3px 0px';
155+
h.style.display = 'none';
156+
g.appendChild(h);
157+
i = document.createElement('div');
158+
i.style.fontFamily = 'Helvetica, Arial, sans-serif';
159+
i.style.textAlign = 'left';
160+
i.style.fontSize = '9px';
161+
i.style.color = 'rgb(' + b.mb.fg.r + ',' + b.mb.fg.g + ',' + b.mb.fg.b + ')';
162+
i.style.margin = '0px 0px 1px 3px';
163+
i.innerHTML = '<span style="font-weight:bold">MB</span>';
164+
h.appendChild(i);
165+
a = document.createElement('canvas');
166+
a.width = 74;
167+
a.height = 30;
168+
a.style.display = 'block';
169+
a.style.marginLeft = '3px';
170+
h.appendChild(a);
171+
q = a.getContext('2d');
172+
q.fillStyle = '#301010';
173+
q.fillRect(0, 0, a.width, a.height);
174+
E = q.getImageData(0, 0, a.width, a.height);
175+
return {
176+
domElement: g,
177+
update: function () {
178+
u++;
179+
j = new Date().getTime();
180+
n = j - F;
181+
z = Math.min(z, n);
182+
A = Math.max(A, n);
183+
s(B.data, Math.min(30, 30 - (n / 200) * 30), 'ms');
184+
c.innerHTML =
185+
'<span style="font-weight:bold">' +
186+
n +
187+
' MS</span> (' +
188+
z +
189+
'-' +
190+
A +
191+
')';
192+
o.putImageData(B, 0, 0);
193+
F = j;
194+
if (j > v + 1e3) {
195+
l = Math.round((u * 1e3) / (j - v));
196+
w = Math.min(w, l);
197+
x = Math.max(x, l);
198+
s(y.data, Math.min(30, 30 - (l / 100) * 30), 'fps');
199+
d.innerHTML =
200+
'<span style="font-weight:bold">' +
201+
l +
202+
' FPS</span> (' +
203+
w +
204+
'-' +
205+
x +
206+
')';
207+
m.putImageData(y, 0, 0);
208+
if (t == 3)
209+
(p = performance.memory.usedJSHeapSize * 9.54e-7),
210+
(C = Math.min(C, p)),
211+
(D = Math.max(D, p)),
212+
s(E.data, Math.min(30, 30 - p / 2), 'mb'),
213+
(i.innerHTML =
214+
'<span style="font-weight:bold">' +
215+
Math.round(p) +
216+
' MB</span> (' +
217+
Math.round(C) +
218+
'-' +
219+
Math.round(D) +
220+
')'),
221+
q.putImageData(E, 0, 0);
222+
v = j;
223+
u = 0;
224+
}
225+
},
226+
};
227+
};
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
# All Laptop Detailer
3+
4+
# imported necessary libraries
5+
import tkinter
6+
from tkinter import *
7+
import tkinter as tk
8+
import tkinter.messagebox as mbox
9+
import pandas as pd
10+
11+
# created a main window
12+
window = Tk()
13+
window.geometry("1000x700")
14+
window.title("All Laptop Detailer")
15+
16+
# ------------------------- for showing gif image on the main window ------------------------------
17+
frameCnt = 3
18+
frames = [PhotoImage(file='Images/laptops.gif',format = 'gif -index %i' %(i)) for i in range(frameCnt)]
19+
20+
cnt = 0.0
21+
def update(ind):
22+
global cnt
23+
frame = frames[ind]
24+
if(cnt == 1.0):
25+
cnt = 0
26+
cnt = cnt + 0.2
27+
ind += int(cnt)
28+
if ind == frameCnt:
29+
ind = 0
30+
label.configure(image=frame)
31+
window.after(100, update, ind)
32+
label = Label(window)
33+
label.place(x = 100, y = 100)
34+
window.after(0, update, 0)
35+
# --------------------------------------------------------------------
36+
37+
# read the data using pandas library
38+
data = pd.read_csv("laptop_dataset.csv")
39+
Product = data["Product"].tolist()
40+
Company = data["Company"].tolist()
41+
TypeName = data["TypeName"].tolist()
42+
Inches = data["Inches"].tolist()
43+
ScreenResolution = data["ScreenResolution"].tolist()
44+
Cpu = data["Cpu"].tolist()
45+
Ram = data["Ram"].tolist()
46+
Memory = data["Memory"].tolist()
47+
Gpu = data["Gpu"].tolist()
48+
OpSys = data["OpSys"].tolist()
49+
Weight = data["Weight"].tolist()
50+
Price_euros = data["Price_euros"].tolist()
51+
52+
def histroy_details():
53+
mbox.showinfo("Laptop History", "Grid Compass\n\nThe first laptop-sized notebook computer was the Epson HX-20, invented (patented) by Suwa Seikosha's Yukio Yokozawa in July 1980, introduced at the COMDEX computer show in Las Vegas by Japanese company Seiko Epson in 1981, and released in July 1982.\n\nThe first laptop was made in 1982 Enclosed in a magnesium case, it introduced the now familiar clamshell design, in which the flat display folded shut against the keyboard. The computer was equipped with a 320×200-pixel electroluminescent display and 384 kilobyte bubble memory.")
54+
55+
def get_details():
56+
product = product_var.get()
57+
for i in range(0, len(Product)):
58+
if(Product[i] == product):
59+
mbox.showinfo(product + "Details", str(product) + "\n\n1.) Company Name : " + str(Company[i]) + "\n\n2.) Laptop Type : " + str(TypeName[i]) + "\n\n3.) Screen Inches : " + str(Inches[i]) + "\n\n4.) Screen Resolution : " + str(ScreenResolution[i]) + "\n\n5.) CPU Model : " + str(Cpu[i]) + "\n\n6.) RAM Characteristics : " + str(Ram[i]) + "\n\n7.) Memory : " + str(Memory[i]) + "\n\n8.) GPU Characteristics : " + str(Gpu[i]) + "\n\n9.) Operating System : " + str(OpSys[i]) + "\n\n10.) Laptop's Weight : " + str(Weight[i]) + "\n\n11.) Laptop's Price : " + str(Price_euros[i]))
60+
return
61+
62+
# top label
63+
start1 = tk.Label(text = "ALL LAPTOP DETAILER", font=("Arial", 50), fg="magenta",underline=0) # same way bg
64+
start1.place(x = 120, y = 10)
65+
66+
# label for laptop product ---------------------------------------------------------------------------------
67+
modellbl = tk.Label(text = "LAPTOP PRODUCT : ", font=("Arial", 30), fg="brown") # same way bg
68+
modellbl.place(x = 100, y = 550)
69+
70+
# creating the drop down menu button for selecting laptop model
71+
product_var = tk.StringVar()
72+
product_choices = Product
73+
product_menu = OptionMenu(window, product_var, *product_choices)
74+
product_menu.config(font=("Arial", 20), bg = "light green", fg = "blue", borderwidth=3)
75+
product_menu["menu"].config(font=("Arial", 10), bg = "light yellow", fg = "blue")
76+
product_menu.place(x=500, y=545)
77+
product_var.set("MacBook Pro")
78+
79+
# laptop button
80+
laptopb = Button(window, text="LAPTOP",command=histroy_details,font=("Arial", 20), bg = "light green", fg = "blue", borderwidth=3, relief="raised")
81+
laptopb.place(x =100 , y =620 )
82+
83+
# details button
84+
getb = Button(window, text="DETAILS",command=get_details,font=("Arial", 20), bg = "light green", fg = "blue", borderwidth=3, relief="raised")
85+
getb.place(x =320 , y =620 )
86+
87+
# function created for reset button
88+
def reset_label():
89+
product_var.set("MacBook Pro")
90+
91+
# created reset button
92+
resetb = Button(window, text="RESET",command=reset_label,font=("Arial", 20), bg = "light green", fg = "blue", borderwidth=3, relief="raised")
93+
resetb.place(x =550 , y =620 )
94+
95+
# function for exiting
96+
def exit_win():
97+
if mbox.askokcancel("Exit", "Do you want to exit?"):
98+
window.destroy()
99+
100+
# created exit button
101+
exitb = Button(window, text="EXIT",command=exit_win,font=("Arial", 20), bg = "red", fg = "blue", borderwidth=3, relief="raised")
102+
exitb.place(x =770 , y =620 )
103+
104+
105+
window.protocol("WM_DELETE_WINDOW", exit_win)
106+
window.mainloop()
183 KB
Loading
166 KB
Loading
162 KB
Loading
150 KB
Loading
175 KB
Loading
129 KB
Loading
182 KB
Loading
579 KB
Loading

0 commit comments

Comments
 (0)