Well, I finally broke down and decided to use AI for something actually useful. For a long time, I’ve had a very specific use-case for an iOS app:
- Grab my current IP
- Send it to Vultr (or any cloud provider) through a RESTful API and add it to the firewall rules
Nothing really seems to meet this requirement (admittedly, I haven’t tried too hard)–and while I can do it through the browser, that’s really clunky: it requires me to turn off the proxy, log into the provider manually, and make the edits to the firewall rules. I really just want to be able to push a button.
So what did I break down and do? I asked ChatGPT how I would go about doing this. It was a little clunky: first it gave me some Swift code that looks like it does what I’m talking about. But I can’t just go and implement this on a Macbook. The Macbook in the house isn’t mine! I can “borrow” it to compile and push to my device, but I can’t develop on it. So I asked ChatGPT “how would I build this on a Linux machine?”
ChatGPT gave me the two curl commands that would do this:
IP=$(curl -s https://api.ipify.org)
curl -X POST https://example.com/report-ip \
-H "Content-Type: application/json" \
-d "{\"ip_address\":\"$IP\",\"platform\":\"linux\"}"
That’s great! But that’s not what I actually asked ChatGPT, so I had to ask a different way: “No. How would I make the iOS app on a Linux machine.”
First, ChatGPT gave me the hard truth: you can’t build and sign an iOS app on a Linux machine! <sarcasm>Man, I wish I knew that!</sarcasm> No matter. Then ChatGPT was a little weird and told me the three ways to do this and then told me this:
Best balance
- Develop logic + UI on Linux using Flutter
- Or write pure Swift logic on Linux
- Use a cloud Mac only for final builds
I like how their recommendation has an or in it…
I had forgotten about flutter! But one of the major issues I have with other languages and new frameworks is I spend a lot of time searching how to do things and the examples are always a bit wonky. To me, this is where AI actually helped: it gave me some structure to start with: an initial flutter application that fits square into the template in vscode, so I was able to modify it pretty easily without having to do any searching. It’s probably important to note that when I end up searching for how to do something unique (even if it’s simple), I end up going through multiple different StackOverflow answers. This saves a significant amount of time.
That was pretty cool, BUT:
I tried to use AI to port a Python script I have over to PowerShell and OMG, that was insane. Every single step of the way the PowerShell would error and ChatGPT would say “you’ve run into one of the classic PowerShell blunders!” It ended up not figuring out how to generate the proper formatting to pass commands to the AWS CLI without errors. I ended up going down the route of loading a PowerShell library for AWS. The first one they suggested doesn’t work with PowerShell 5 (the version installed on this Windows 11 system by default). Eventually, we got it working with a different PowerShell library–and even then it required a significant amount of back and forth with the AI. It was a little intense. At the end of the day, I’m not sure it saved me any time… But it was a neat exercise and I now have a PowerShell version of that script that is superior to the batch script I was using before.
Image from: https://www.vpnsrus.com/, which now seems defunct… But they said to put the link to credit the image.