« GRITZ Home | Email msg. | Reply to msg. | Post new | Board info. Previous | Home | Next

Re: A.I.

By: De_Composed in GRITZ | Recommend this post (0)
Sat, 16 Aug 25 4:40 AM | 34 view(s)
Boardmark this board | Grits Breakfast of Champeens!
Msg. 11678 of 11928
(This msg. is a reply to 11609 by De_Composed)

Jump:
Jump to board:
Jump to msg. #

More coding. I'm on a roll like never in my life.

I started today working on images, writing code that creates images that can be generated in unlimited quantities and moved with mouse clicks and dragging, deposited or even stacked upon a background. This is part of something I've wanted to do for years. I'm not going to go into it with you guys though, because it's not done and may never be (which'd be embarrassing now that I know how to do it)... and it could be marketable, so I don't want to screw the pooch by blabbing.

Then I got distracted by all the cookies my system keeps accumulating and decided to investigate where they're coming from. The major browsers all store their cookies in a SQLite database, and I found out yesterday that I can read that from Lazarus. So I wrote a program that generates two reports about cookies: Detail and Summary. The conclusion to the Summary report is shown to the right. I'm not surprised to see that I'm getting cookies from some WEIRD places. Now I'll need to see what I can do about them.

Then I almost wiped out my browsers - all of them - by monitoring cookie-generation in realtime.

I did that by inserting a python program between the browser and the computer's HTTP port, thereby monitoring everything that was happening. It worked great, but Chrome slowed down so much that I had to call it quits. (I was getting "broken images" left and right on sites like Breitbart.com.)

It didn't occur to me at the time (though it seems obvious now) that killing the python script would also kill ALL of my browsers. As in, they couldn't see the internet anymore! Fortunately, I remembered what I'd done (which A.I. did not, thank you) and was able to reverse the proxy changes I'd made in Windows.

It was a really good and somewhat nerve-wracking day.

If any of you are interested in directly reading port 8080 (but with a faster computer), the python script you'll need follows. The code does work and is pretty cool.





from mitmproxy import http
from collections import defaultdict

cookie_counts = defaultdict(int)

def response(flow: http.HTTPFlow) -> None:
domain = flow.request.host
set_cookie_headers = flow.response.headers.get_all("Set-Cookie")
cookie_counts[domain] += len(set_cookie_headers)

def done():
print("\n=== Cookie Count by Domain ===")
sorted_domains = sorted(cookie_counts.items(), key=lambda x: x[1], reverse=True)
for domain, count in sorted_domains:
print(f"{domain}: {count} cookies")




» You can also:
- - - - -
The above is a reply to the following message:
Re: A.I.
By: De_Composed
in GRITZ
Thu, 14 Aug 25 7:13 AM
Msg. 11609 of 11928

I've been having a heck of a lot of fun programming of late. It hasn't been like this since high school, when everything was new and interesting.

Today's big project was reading the internet. I wrote a Lazarus Pascal program that can visit a website and retrieve its HTML. After this, writing a web crawler of my own would be pretty easy.

While I was doing that, I talked to a friend and raved about all the new things I've been writing since learning how to use CoPilot, Grok and Chat GPT. On a lark, he dared me to write a program that could read a database.

"But that doesn't really interest me," I said.

"Aw, c'mon," he teased. "I tried to do it a while back and gave up out of frustration. I bet you can't do it."

"So, which database?" I asked. "I only have Access."

"No, that's not typical." he said. "Try MySQL. Or... there's a little one called SQLite that's getting a lot of attention. And it's free. Read that."

By 10 p.m., I had come to a break point on my internet reader. I decided to install SQLite. From there I decded to create a simple database... two tables... one for Employees and one for Sales. I related them: You can have multiple sales per employee but not multiple employees per sale. Then I populated the tables with data. Then I tracked down the .DLL that's needed to read relational databases and dropped it into the folder with the EmpSales.db I'd made. And then I created empssalesreport in Lazarus... compiled it... ran it... and was done. I finished just before midnight. Less than two hours - which is pretty damned good considering that I barely know Lazarus and don't know SQLite at all.

All in all, a very good day.



« GRITZ Home | Email msg. | Reply to msg. | Post new | Board info. Previous | Home | Next