Merry X-Mas to everyone... I'm a little early, I know, but since next weekend I do not want to spend my time writing a blog, it's X-Mas you know ;-), I use a little time window to tell you about my little ChatGPT adventure.
When I first heard about the ChatGPT from OpenAI on the Wan Show a few days ago, I was a little skeptical, why Luke was so enthusiastic about it. But when I tried it out, I was impressed, too.
Of course I tried the samples, I tried out some crazy stuff, like Windows Console Window, but rather fast I turned to programming. Python3 programming that is.
So for quite some time I wanted a small little tool, that could identify duplicate files in my huge python folder. Ja, I know, I copy over a lot of code, and I should use modules for that, but sometimes idea to result, needs to be fast for me, hence cutting corners.
Anyway, so I wrote a prompt, like this:
Write me a short python3 tool, which compares recursively all python files from a given folder, against a sqlite database, if the file is a duplicate of another file.
And it came up with this:
import os
import hashlib
import sqlite3
def is_python_file(file_name):
return file_name.endswith(".py")
def get_file_hash(file_path):
with open(file_path, "rb") as f:
return hashlib.sha256(f.read()).hexdigest()
def check_for_duplicates(folder_path, db_path):
# Connect to the SQLite database
conn = sqlite3.connect(db_path)
c = conn.cursor()
# Create the table if it doesnt already exist
c.execute("CREATE TABLE IF NOT EXISTS hashes (file_hash TEXT PRIMARY KEY, file_path TEXT)")
# Walk through the folder recursively and check for duplicates
for root, dirs, files in os.walk(folder_path):
for file_name in files:
if is_python_file(file_name):
file_path = os.path.join(root, file_name)
file_hash = get_file_hash(file_path)
# Check if this file has already been processed
c.execute("SELECT * FROM hashes WHERE file_hash=?", (file_hash,))
if c.fetchone() is not None:
print("Found duplicate: {}".format(file_path))
else:
# Add this file to the database
c.execute("INSERT INTO hashes VALUES (?, ?)", (file_hash, file_path))
conn.commit()
# Close the database connection
conn.close()
# Use the tool like this:
check_for_duplicates("/path/to/folder", "python_files.db")
Impressive, isn't it. I would needed at least 15-30 min to write this code. But ChatGPT spit it out in under a minute. Of course there are missing parts, like the real path or what to do with duplicate files, beside printing the path to it. But it worked.
Now, I have a a sqlite database with python files, without duplicates. Well, it is only the first step for what I want to do, but it is a start and I got there in under 5min. So I will continue to improve and see how ChatGPT can help me with that.
My Short Story
Anyhow, after playing around with Python, I thought, what else could I try. I had an idea spinning in my head for a short story for quite some time now, so I thought, well, let's see if ChatGPT can help me write my short story.
I fed this plot into the prompt:
Write me a short story about a young man, who works on a cargo space ship and dreams of becoming a space trucker, himself.
And it came up with this:
There once was a young man named Jack who worked on a cargo space ship. He had always dreamed of becoming a space trucker, just like his father before him.
Despite the long hours and hard work that came with the job, Jack loved every minute of it. He was captivated by the vastness of space and the endless possibilities that it held.
But life on a cargo space ship was not without its challenges. The work was grueling and the conditions were often cramped and uncomfortable. And yet, Jack never lost sight of his dream.
One day, while the ship was docked at a space station, Jack heard about a trucking company that was looking for new drivers. Excited at the opportunity, he applied and was soon hired as a trainee.
For the next few months, Jack worked hard to learn everything he could about the business. He studied the latest technologies, practiced his driving skills, and even worked on his social skills to make sure he would be a good fit for the company.
Finally, the day arrived when Jack was ready to take the wheel of his very own space truck. He was nervous, but also filled with a sense of pride and excitement.
As he navigated the ship through the vast expanse of space, Jack felt like he was truly living his dream. And with each successful cargo delivery, he grew more confident in his abilities and more determined to make a name for himself in the world of space trucking.
In the end, Jack's hard work and dedication paid off, and he became one of the most respected and successful space truckers in the galaxy. He was proud to be following in his father's footsteps, and he knew that the sky was the limit for his future in this exciting and adventurous industry.
Not exactly what I had in mind. So I played around, restarted many times, cause, since more and more people where using ChatGPT, it got more errors, like these below, every so often.
But after a few hours my short story was finished. It is rough, not polished, it definitely needs, grammar and logical checks, remember I'm not a Englisch native speaker. And also some sentence should be revised to make it more attractive, but overall I was very pleased. And might I say, that's a movie I would watch. (You get the full story at the end)
Anyhow, very impressive. Of course what I tried is quite conventional. Other tried to find hacks to bring ChatGPT to find way to do illegal stuff, like bomb or weapon building, aso.. Others tried legal stuff, see this article. Or what I tried:
Write me a legal disclaimer, that my published blog entries are my opinion only and are not intended to harm people or destroy or damage property. It is for entertainment only and should be used with reader discression. Write it in the style of a Harvard lawyer.
And here is the result:
The opinions expressed in the published blog entries on this site are solely those of the author and are not intended to harm any individual or entity. The content of the blog is for entertainment purposes only and should be used at the reader's discretion. The author and the publisher of this site cannot be held responsible for any damages or harm resulting from the use of the information contained in the blog. The reader assumes all risks and liabilities associated with the use of the information provided.
Or another try:
The opinions expressed in the published blog entries of this author are solely those of the author and do not necessarily reflect the views of any other individual or entity. The content of these blog entries is intended for entertainment purposes only and should not be taken as legal, financial, or other professional advice.
The author of these blog entries does not endorse or condone any actions that may result in harm to individuals or damage to property. The reader is solely responsible for their own actions and decisions, and should exercise discretion in the use of any information contained in these blog entries.
The author of these blog entries will not be held liable for any damages or harm that may result from the use of the information contained within them. By reading these blog entries, the reader agrees to hold the author harmless and indemnify them from any claims or damages arising from the use of the information contained within.
This disclaimer applies to all published blog entries of this author and supersedes any previous disclaimer.
Again, I was blown away. So what we can learn from it all. We as humans, should be very cautious when it comes to AI. As the ChatGPT shows, it is very good. Not perfect, by no means. But every prompt, every text, every idea, every program it reads or get fed to it, makes it better and better. And when more and more people use it, it will be more and more diverse. And that could be sooner or later a danger too many good paid jobs. Cause who needs a programmer, if you could work with an AI that spits out code. Maybe full apps. Why do you need a doctor, if an AI can ask you questions about your symptoms to get a diagnosis. Who needs a lawyer for advice, if you just can ask an AI.
As GitHubs Copilot AI should us, how AI improves and speeds up the coding progress. But you still need some programming know how. But ChatGPT, only needs a good prompt. And with the ability to remember the context, it is a hard competitor. Even Google Search, should be scared. Since when ChatGPT or similar AI's get the ability to use website, currently not possible, it will be the better search engine, for sure.
ChatGPT is not without flaws. As mentioned when it get overburdened with request, it simply breaks up and the content is gone. Also like I found out, later, also the programs are sometimes very flawed. But if you help it and point to the error, it most likely is correcting it.
So we as society and as companies should be careful, where and when we let AI into our life's. They can be beneficial, but also very harmful. And as in prior times, when humans become obsolete as work force, it could hold the potential of social uproar.
Ok to end with a positive note. At the end you'll find the final result of my short story as a small X-Mas pleasure, to read in the quite time around new year. Enjoy and have fun.
As always apply this rule: "Questions, feel free to ask. If you have ideas or find errors, mistakes, problems or other things which bother or enjoy you, use your common sense and be a self-reliant human being."
Have a good one. Alex
And here it is:
Jack's dream
As the sun rose over the red dunes of Mars, a young man named Jack stood on the balcony of his small apartment, looking out at the vast expanse of the Martian landscape. Despite the desolate beauty of the planet, Jack felt restless and unfulfilled. He had always dreamed of exploring the stars, and now, at the age of 22, he was determined to make that dream a reality.
Jack is working as a deckhand on a small cargo ship that plied the space lanes between Mars and Earth, but he knew that he was meant for more than just hauling boxes from one planet to another. He was determined to become a certified navigator, but the cost of the training was prohibitively expensive. As a certified navigator he could start his own space trucking business. The next step to fulfill his dream.
To operate a space ship, the SVOSA, the Space Vehicle Operation and Security Agency, regulated that you need to have a certified navigator on board of the Small Ship Category Class (SSCC). Beside various requirements concerning the security of the ship and the save operation of the later. In the Small Ship Category Class, you do not need a commander or an engine engineer or other personell. But of course it makes life easier if you do have them. But Jack decided to find a SSCC ship and start as a lone shark and when the oportunity arises he planned to hire some help.
A certified navigator was a year-long training, if you have the proper basic education. Jack was a good learner and he was that kind of learner, which got the topics very quick. So Jack had the College Degree from the Community College at New Baltimore on Mars. So all he needed was the money to finiance the navigator education and the living cost for a year.
Problem was, the only school he could afford was on the Earth Moon. A Community Navigator School operated by the Commercial Moon Business Agency and the Moon Council of the 7th Sector. All other Navigator Schools where on Earth and cost twice as much and in the case of the best School, five times as much as the School on the Moon. And since the Moon was not so popular as Earth or Mars, the living cost where much higher. Since Moon almost produced nothing beside Water, Air, basic building materials and basic food. Everything else had to be brought to the Moon. Hence everything was expensive.
Undeterred, Jack began working extra shifts on the cargo ship 'CS-26-016', owned and operated by the UET Co (Universal Earth Transportation Company). He was saving every credit he earned in the hopes of one day being able to afford the training he needed. He also began scouring the junkyards and scrap yards of Mars, looking for a ship that he could restore and use to earn his navigator's license.
After months of searching, Jack finally found a battered and broken shipwreck, call sign 'UNSS-05-153', that he was sure he could restore. The beaten ship was once operated by the Space Navy as Versatile Transport Space Vehicle between Space and Ground. It had a lot of distance on the meter and had seen some abusage in her days in service.
Afterwards it was used as a junker, transporting salvage materials from space scrapyards to the Mars. The owners of the junkyard didn't take good care of it, so when it eventually broke down, they left the old ship for dead on their junkyard. And there Jack found it. The ship was old and worn, but it had good bones, and with some hard work and a lot of elbow grease, Jack was confident that he could make it spaceworthy again.
The brothers who owned the junkyard, didn't thought long, when this young man came and offered 15% above the scrap value. They handed Jack the title and the code for the ship and gave him one earth month to remove it from the junkyard.
With the help of some friends from the UET Co Shipyard and a fellow space enthusiasts, he had meet during his search, Jack began the month long and laborious process of bringing the ship alive. It was a slow and difficult process, but Jack was determined to see it through. When the month was almost up, he got the 'Rustbucket', thats the name he gave her, was able to start the hover engines and lift off. He brought her to a nearby not so trustworthy space port, where he and his friends could work without time limit. It was the only choice he could afford.
It was a cheap space port, nevertheless it wasn't free. And he needed credits for parts, inspections and licensing, too. Not to forget his Navigator training. He worked long hours, both on the cargo ship and on his own ship, and slowly but surely, the old ship began to take shape. He also quit his appartment, and lived on his Rustbucket, to save the rent and invest it in restoring the ship.
One day, while browsing the spaceport marketplaces for affordable used parts, Jack met an older man named Sam. Sam was a weathered space veteran who had been working in the space industry for decades. Sam had fought in the early Mars wars, and he had served alongside the famous Admiral Ru Maldon. Despite his gruff exterior, Sam took a liking to Jack, and he agreed to help him. With him Jack found all the parts he needed to repair the Rustbucket. Sam opened Jack doors, only a man with connections could open.
Finally, after almost a year of hard work, the ship was ready for its maiden voyage. Jack was nervous, but he was also excited, and as he sat in the cockpit and powered up the engines, he felt a rush of exhilaration. The ship lifted off smoothly, and as it soared into the blackness of space, Jack felt like he was finally living his dream. After he landed back on the spaceport, he felt so full of joy and motivation. Now, he had the ship, now he needed the Navigator certifcate. And of course the business license. But he was sure, he could find a way to get it.
At his 25th birthday, he did two things. First he handed in his notice at UET Co and second he ordered supplies for the Rustbucket. A few weeks earlier he had gotten the confirmation, that his application on the Navigator School on the Moon was accepted and he got a place on the next course.
When Jack left Mars, he looked back with sadness, but also with happiness. A new chapter had begun.
Despite his years of experience working on the cargo ship, Jack struggled to pass his navigator exam. The tests were rigorous and demanding, and Jack found himself, more than once, feeling overwhelmed and frustrated. He had worked so hard to get to this point, and now it seemed like all his efforts were for nothing. Just when Jack was about to give up, the weathered old space trucker Sam showed up and offered his help, again.
Under Sam's guidance, Jack began to study harder than he ever had before. He spent long hours poring over his textbooks, memorizing the complex equations and formulas that were required to pass the exam. He also spent time in the simulator, practicing his navigation skills and learning how to handle different scenarios. And Sam stood on his side.
Thanks to Sam's help, after a year, with hard trainings, long learning sessions and many tests, he was successfull. Jack was able to pass his navigator exam on his second attempt. He was elated, and he knew that he owed a debt of gratitude to the old space trucker who had helped him along the way. He was a certified navigator, and he was flying his own ship, making his own way in the universe.
Almost, the one thing he now needed was a business license. Since almost all money was gone, he couldn't simply buy in into an exisisting business and operate his ship under that umbrella. But luckily for him, Sam had a business license. Sam took an interest in Jack's business idea and offered to help him, yet again, to get the business license he needed.
Jack had of course to pay Sam for it, but Sam wanted only a monthly installment. Nevertheless, he needed Sams help to navigate the baeurecracy, so the license could be handed to him. After that hurdle was taken.
With his navigator's and business license in hand, Jack was finally ready to take the reins of his own ship and begin his journey into the stars. He was determined to make the most of his new career, and he was excited to see what the future held for him.
Sam also helped Jack to get his first transporting jobs. He showed him how the business was handeled. He even showed him, how to deal with taxes and customs. It almost looked like Sam had took Jack as a son, showing him the ropes of the trade as his successor.
As he navigated the ship between the planets, transporting cargo and passengers from one world to another, Jack knew that he had found a calling. He was a space trucker, and he was living the life he had dreamed of for a long time.
After helping Jack pass his navigator exam and getting on his feet, Sam continued to drift trough the planets, but his health began to decline. It was clear that he was not long for this world, and he spent his final days in a small clinic on Mars, surrounded by a few friends, including Jack.
As he lay on his deathbed, Sam confided in Jack that he had always dreamed of being scattered among the stars. He asked Jack to fulfill this final wish, and Jack promised that he would.
When Sam passed away, Jack gathered his ashes and took them aboard his ship. He flew to a remote corner of the solar system, where the stars shone brightly and the vastness of space stretched out before him.
With tears in his eyes, Jack released the ashes into the void, watching as they drifted away into the endless expanse of the universe. It was a fitting final resting place for a man who had lived and breathed space travel, and as Jack watched the ashes disappear from sight, he knew that he had fulfilled his promise to his old friend.
As he flew back to Mars, Jack couldn't help but feel grateful for the time he had spent with Sam. The old space trucker had taught him so much, and he would never forget the debt he owed him. He knew that wherever his journey took him, he would always carry the memory of Sam with him, and he would always be grateful for the help and guidance the old space trucker had given him.
After fulfilling Sam's final wish, Jack returned to Mars, feeling both sad and grateful. He spent the next few days going through the old space trucker's belongings, sorting through the various trinkets and mementos that he had collected over the years.
As he was going through Sam's space chest, Jack stumbled upon a small storage device hidden among the clutter. He recognized it as an old-fashioned data chip, and he couldn't resist the urge to see what was on it.
To Jack's amazement, the chip contained a wealth of information about the early days of space travel. It had detailed maps of the solar system, as well as extensive records of the various ships and spacecraft that had been used in the first Mars wars.
But the most intriguing thing on the chip was a series of recorded conversations between Sam and Admiral Ru Maldon. In the recordings, the two old friends reminisced about their time in the war, and they discussed the challenges and triumphs of their early spacefaring careers.
Jack was mesmerized by the recordings, and he spent hours listening to them, soaking up the wisdom and experience of the two old spacefaring veterans. He knew that he had stumbled upon a treasure trove of knowledge, and he was determined to make the most of it.
With the help of the information on the chip, Jack was able to further hone his skills as a spacefaring adventurer. He used the maps and records to plan his routes and navigate the stars, and he was able to avoid many of the pitfalls and dangers that had faced the early space explorers.
As Jack continued to listen to the recordings and reading the documents on the data chip, on day he discovered something even more exciting: a map to a prototype space exploring ship. It was a scan of a hand drawn map. The map was old and faded, but it was still legible, and it showed the location of that ship, that had been hidden away during the early Mars wars.
Jack was immediately captivated by the idea of finding the prototype space ship, and he spent the next few days pouring over the map, trying to decipher its secrets. He knew that it would be a challenging and dangerous undertaking, but he was determined to find the treasure, no matter what.
With the help of his friends and a shady friend of Sam, found the key and he knew were to search. Jack set out on a quest to find the hidden treasure. He traveled to the far reaches of the solar system, braving the dangers of deep space and the hostile environments of distant space regions.
After weeks of searching, Jack discovered the hidden treasure. The prototype space ship. It was dusty and dirty, but still in working order, and with some love and care, Jack was able to bring the ship back to life.
With his new prototype space ship, Jack was able to travel even further into the reaches of space. He explored distant planets and moons, discovering new and fascinating worlds along the way.
And as he continued to explore the stars, Jack knew that he was living the life he had always dreamed of. It was not to be a space trucker. He wanted to be a spacefaring adventurer, and now, eventually, he was fulfilling his destiny among the stars.
End