Because, why not? I thought it would be cute to see if I could get it to write an article about my experience setting up my own pfSense router (and being a software developer, it was a bit of an animal for me). With a rough descriptive prompt, including to use my style of writing, it came up with a short article that sounded like a transcript from a TikTok video. Yeah, awful.
I tried to refine it by telling it to use the style found on russjudge.com (this site), but the result wasn’t much better. When it opened up with “Hey everyone, it’s your boy Russ Judge, and today I want to talk to you…”, I knew I was in trouble. The article sounded like a hyperactive narcissist on ten cans of Red Bull. It made me think that ChatGPT must be part of the Gen Z generation.
A simple example was that I wanted to create a BASH script (for which I am rather inexperienced in) that would get the quote of the day from the “They Said So Quotes API” (https://quotes.rest), and the update the message of the day file (/etc/motd) on my Linux servers. That was pretty much the extent of the prompt I gave to ChatGPT. It quickly spit out working code–except that the quote it got was blank. I’m also not very familiar with how to use grep, so I couldn’t easily tell what was wrong with the code. I told ChatGPT that the code was wrong–that returned blank, so it tried again. After the third iteration, it finally came up with fully working code, which I’ve included below (along with some additional tweaks of my own).
As a work tool, ChatGPT is invaluable. I’m even considering paying the $20 a month for a subscription to the premium version. I’ve heard many fears that it will replace people in their jobs, but I see it as a way to take the grunt work off of me, where I can focus on the logic of what I want done, and then refine what ChatGPT spits out to better suit my needs. In my opinion, it gives me the freedom to focus more on the details of the tasks, as opposed to the syntax of the code.
I talked to one of my friends who works at a local community college, and he told me that some computer programming professors are prohibiting the use of ChatGPT in their class. Although I can see that point when you are trying to teach beginners the basics of programming, once the coding gets more sophisticated, I see ChatGPT as a way to more quickly learn the skills needed to get in a programming career. In my use of ChatGPT, I learned from ChatGPT far more quickly than if I had to spend time googling for the answer, scouring through the tech forums like Stackoverflow and such. Where this scouring would take me 30 minutes to an hour to find an answer for, ChatGPT does in under 5. The learning curve in using ChatGPT is learning how to phrase your prompt to get the best results.
So, what are your thoughts? Even though my experience with its use of writing articles was a bust, I think Hollywood could learn a thing or two from it. Heck, I say fire all the Hollywood writers and just use ChatGPT. Can’t possibly get any worse doing that.
Anyway, here’s the code I mentioned:
#!/usr/bin/bash #Author: ChatGPT and Russ Judge # Below is my code--this makes sure it was executed with BASH, so that # the ANSI coding works. if [ -z "$BASH" ] then exec bash $0 exit else # This part is from ChatGPT: # Fetch the quote of the day from the website response=$(curl -s https://quotes.rest/qod?language=en) #These are the failed lines from ChatGPT. #quote=$(echo "$response" | grep -o '"quote":"[^"]*"' | cut -d '"' -f 4) #quote=$(echo "$response" | grep -oP '(?<="quote":")[^"]*') #quote=$(echo "$response" | sed -n 's/.*"quote":"\([^"]*\)".*/\1/p') # This is where it started working, from ChatGPT. I had to install "jq", though. quote=$(echo "$response" | jq -r '.contents.quotes.quote') #I added this line--I never told ChatGPT to code for getting the author of the quote. author=$(echo "$response" | jq -r '.contents.quotes.author') #I also added this conditional--I found in my testing that the # "quote" could be null if the website was queried more than # 10 times in an hour. if [ "$quote" == "null" ] then echo "Bad response retrieving quote of the day." else #Below is both me and ChatGPT together. It originally just # dumped the quote into the /etc/motd file. I added a little # flurish with ANSI coding--for the heck of it. # Modify the motd file with the quote of the day echo -ne " \e[0;32;40m==========================================================\e[0;37;40m \e[1;37;40m Russ's Server: $HOSTNAME\e[0;37;40m \e[0;32;40m==========================================================\e[0;37;40m $quote -$author ========================================================== " > /etc/motd fi fi