Ad Man turns Code Man? My Python Adventure

Hey there, folks! Today, I want to talk about something a bit different but incredibly relevant—Google’s IT Automation with Python course. In a world where AI and technology are reshaping industries, it’s crucial for us professionals to keep up, no matter our field. So, let’s dive in!

Why This Course?

You might be wondering, “Why would a seasoned advertising professional like me venture into Python and IT automation?” Well, the answer lies in the fascinating world of AI, particularly Large Language Models (LLMs). I’ve always been intrigued by generative AI applications and wanted to build some using APIs from OpenAI, Google Cloud, and more.

But here’s the catch—I didn’t know coding. I realized that while working with ChatGPT, a machine that’s great at generating simple codes, I was limited by my own knowledge. I didn’t even know what to ask the machine to do! So, I decided a beginner-friendly course could give me the broad context I needed.

The Journey and Challenges

Balancing a full-time job, family, and additional commitments is no walk in the park. But guess what? I managed to complete this Google IT Automation with Python course, thanks to my supportive family and some late-night study sessions. And if I hit a snag? ChatGPT was there to help, making the journey relatively smooth. You can check out my completion badge here.

Practical Applications

Now, let’s get to the juicy part—how have I applied these newfound skills? For starters, I’ve become more proficient in using the command line interface to interact with my operating system and virtual instances. I even migrated my blog hosting to a virtual instance on Google Cloud Platform (GCP), ensuring all packages were up-to-date. I made small changes to the GCP default firewall rules to limit the potential attack surface like IP address ranges, changed the default RDP rule for the virtual instance.

Cleaning and Preparing Blog Data

One of the most exciting applications of what I’ve learned is cleaning and preparing data for my blog. With over 450 posts, that’s a lot of data to manage! I’ve written Python scripts to automate these tasks, making my life a whole lot easier.

For instance, I use a Python script called WP_XML_to_Clean_HTML.py to clean the HTML content of my blog posts. This script uses the BeautifulSoup library to remove unnecessary tags and format the text. Here’s a snippet:

# Function to clean HTML content
def clean_html(html_content):
    # Initialize BeautifulSoup object
    soup = BeautifulSoup(html_content, 'html.parser')
    
    # Remove script and style tags
    for script_or_style in soup(["script", "style"]):
        script_or_style.extract()
        
    # ... (rest of the code)

Generating Metadata

Another script I use is Generate_JSON_Lines_Metadata.py, which generates metadata for each HTML file. This is especially useful for training an LLM chatbot. The script uses the hashlib library to generate unique IDs and writes the metadata to a JSON Lines file. Here’s how it works:

# Function to generate a hashed ID
def generate_id(title):
    hashed = hashlib.sha256(title.encode()).hexdigest()
    return hashed[:63]

# ... (rest of the code)

These are just a couple of examples, but they’ve been incredibly helpful in managing my blog and preparing data for other projects. The code is written by chatGPT.

For the full code, visit the GitHub repository

My own chatbot using OpenAI API

Yes after about 5 months, I completed version 0.1 of the chatbot. You can check it out here. Of if you want to understand more about the context, you can read this post “How I Built My Own Chatbot with No Coding Experience: Lessons Learned.

Broader Implications

So, what does this mean for me? These skills have opened up new avenues for automation in my job. Imagine automating mundane tasks, freeing up time for more strategic work. That’s the power of IT automation!

Why Should You Care?

Now, you might be thinking, “That’s great for you, but why should I care?” Well, if a 40-year-old advertising professional can learn and adapt, so can you. The world is changing fast, and staying updated with technological advancements is no longer optional—it’s a necessity.

Conclusion

In a nutshell, this course has been a transformative experience for me. It’s equipped me with the skills to better understand and leverage technology, both in my job and for my hobbies. And if I can do it, so can you. I would love to hear your thoughts or experiences with upskilling. Have you tried using Python? Feel free to share in the comments below.

P.S: again, if you want to check out the full Python code, visit my Github repo here. Let me know if you think the code is good or not, given that it is generated by chatGPT.

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.