ChatGPT as a programming assistant for infrequent coders

I haven’t written code every day for many years but every now and then, a project emerges that requires a little bit of coding. This tends to happen about once a year. In the past, the cost of revving up the coding engine could be pretty high:

  • I would have to re-learn the basics of Git. I keep a private repository of my few coding projects on Github but don’t code often enough for even basic Git commands to be committed to memory.
  • I like working on the command line so inevitably I would have a new computer and have to generate new ssh keys so I wouldn’t have to enter a password when I’m working with the remote Github repository. (I have been using password-less ssh for close to 30 years now and I have never been able to remember the process!)
  • If I’m working with a 3rd party API, I need to read through the documentation to figure out how to do whatever it is that I want to do. Sometimes there is sample code for the language I’m using and sometimes there isn’t.
  • For some projects, credentials are required. I try to handle those responsibly so I have to re-learn Amazon Secrets Manager. . . and that means I have to re-learn the interface for whatever language I’m using to Amazon Secrets Manager.
  • With all that in place, I can now focus on the task at hand.

None of the above is “hard” in a technical sense but it’s all kind of a pain if you don’t code frequently and your environment hasn’t been tended to for a while. My life is also busy so all the grunt work of setting up and maintaining a programming environment is very far down my list of important things to do. For all of the above, I usually figure it all out by using Google but that usually involves digging through documentation (sometimes contradictory or just out-of-date). In the past, I’ve usually reached a point of fatigue with the whole process at this point and then question whether I should be coding again at all.

I have a project in mind that I won’t describe in great detail here but the gist of it is that I want to take bookmarks from Pinboard and make a set of web pages with the data. I decided to use ChatGPT to rev up the coding engine this time and it was so much easier and more immediately productive than other times I’ve been down this path. I’m including my ChatGPT prompts and responses below so you can see what I mean.

It remains to be seen just how deeply ChatGPT penetrates knowledge work and I’m skeptical in many ways — but for this kind of work, it feels pretty magical, especially for a rusty programmer who just wants to get something done.

ChatGPT prompt: Describe basic git commands typically used when working with a remote repository on Github

Here are some basic git commands that are typically used when working with a remote repository on Github:

  1. git clone: This command is used to create a local copy of a remote repository. For example, if you want to clone a repository from Github, you can run the command git clone <repository-url>.
  2. git add: This command is used to stage changes made to a local repository before committing them. For example, if you have made changes to a file in your local repository, you can stage those changes by running the command git add <file-name>.
  3. git commit: This command is used to commit staged changes to a local repository. For example, if you have staged changes to a file in your local repository, you can commit those changes by running the command git commit -m "commit message".
  4. git push: This command is used to push committed changes from a local repository to a remote repository. For example, if you have committed changes to a file in your local repository and want to push those changes to Github, you can run the command git push.
  5. git pull: This command is used to fetch and merge changes from a remote repository to a local repository. For example, if someone else has made changes to a file in the remote repository, you can fetch and merge those changes into your local repository by running the command git pull.
  6. git branch: This command is used to list, create, or delete branches in a local repository. For example, if you want to list all the branches in your local repository, you can run the command git branch.
  7. git merge: This command is used to merge changes from one branch to another in a local repository. For example, if you want to merge changes from the feature-branch to the master branch in your local repository, you can run the command git merge feature-branch.

These are just some of the basic git commands that are commonly used when working with a remote repository on Github. There are many other git commands that can be used to perform more advanced tasks, such as resolving conflicts, rebasing branches, and more.

ChatGPT prompt: using the command line, how do I set up a git client to work with a remote repository including setup of keys so I can work without a password

To set up a Git client to work with a remote repository and configure SSH keys for passwordless access, you can follow these steps:

  1. Install Git on your machine, if it is not already installed.
  2. Generate an SSH key pair using the ssh-keygen command: ssh-keygen -t rsa -b 4096 -C "" This command will generate a new SSH key pair using RSA encryption and a bit length of 4096. Replace “” with your email address.
  3. Add the public key to your Git hosting provider (e.g. GitHub, GitLab, Bitbucket, etc.) by following their instructions for adding an SSH key.For example, to add a key to a GitHub account, navigate to the “Settings” page, click on “SSH and GPG keys”, and then click on “New SSH key”. Paste the contents of the public key (usually found in ~/.ssh/ into the “Key” field.
  4. Test the SSH connection by running the following command: ssh -T Replace with the hostname of your Git hosting provider. You should see a message similar to the following: Hi username! You've successfully authenticated, but GitHub does not provide shell access. If you see an error message instead, double-check that you’ve added the public key to your Git hosting provider correctly.
  5. Configure Git to use the SSH key for passwordless access by running the following commands: git config --global "Your Name" git config --global "" git config --global core.sshCommand "ssh -i ~/.ssh/id_rsa" Replace “Your Name” and “” with your name and email address, respectively. The last command tells Git to use the SSH key for all SSH connections.
  6. Clone the remote repository to your local machine using the SSH URL: git clone Replace username with your Git username and repo with the name of the repository you want to clone.

That’s it! You should now be able to use Git to push and pull changes to and from the remote repository without entering a password each time.

ChatGPT prompt: write a sample client in PHP that uses the Pinboard v2 API to fetch a list of all bookmarks

(Note: my first prompt simply asked about the Pinboard API and I got a v1 sample. I prompted again and asked for v2)

Sure! Here’s an example PHP client that uses the Pinboard v2 API to fetch a list of all bookmarks:


// Replace with your own Pinboard API credentials
$username = "your_username";
$apikey = "your_apikey";

// Set the URL for the API request
$url = "{$username}:{$apikey}&format=json";

// Set up a cURL session to send the API request
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);

// Decode the JSON response
$bookmarks = json_decode($response, true);

// Loop through the bookmarks and output their titles and URLs
foreach ($bookmarks['posts'] as $bookmark) {
    echo $bookmark['description'] . "\n";
    echo $bookmark['href'] . "\n\n";


Make sure to replace your_username and your_apikey with your own Pinboard API credentials. This client uses cURL to send the API request and fetch the JSON response. It then uses json_decode() with the true parameter to parse the JSON into a PHP associative array, and loops through the array to output the titles and URLs of each bookmark.

Note that the Pinboard v2 API requires authentication using a username and API token, unlike the v1 API which uses a username and password.

ChatGPT prompt: write php code for using Amazon Secrets Manager

(Note: I also asked ChatGPT the same question but without using Composer)

To use Amazon Secrets Manager in PHP, you will need to install the AWS SDK for PHP. You can do this by running the following command:

codecomposer require aws/aws-sdk-php

Once you have installed the AWS SDK for PHP, you can use the following code to access a secret stored in Amazon Secrets Manager:


require 'vendor/autoload.php';

use Aws\SecretsManager\SecretsManagerClient;

$secretsManager = new SecretsManagerClient([
    'version' => 'latest',
    'region'  => 'us-east-1' // replace with the region where your secret is stored

$secretName = 'mySecret';
$result = $secretsManager->getSecretValue([
    'SecretId' => $secretName

$secret = $result['SecretString'];
echo $secret;


In this code, we first load the AWS SDK for PHP using the autoload.php file. Then, we create a new SecretsManagerClient object and provide it with the region where our secret is stored. We also provide the name of the secret we want to access.

Next, we call the getSecretValue method on the SecretsManagerClient object, passing in the name of the secret. This method returns a result object, which we can use to access the secret value.

Finally, we retrieve the secret value from the result object and print it to the screen. Note that the secret value is returned as a string, so you may need to parse it into the appropriate format for your application.

Loads of new stuff from Yahoo! Developer Network for Open Hack Day

Lest you think our Yahoo! Open Hack Day was all about Beck (yes, it was really cool to have him), we also released an incredible stream of stuff for the hackers to play with while they were hanging out with us at Yahoo! There is nothing like a big event with a hacker rock star to mobilize the teams at Yahoo! to tackle the last 10% to get those releases pushed out! Here’s the list. This has been covered in many places already (I was happily buried with Open Hack Day stuff instead of blogging):

  • Browser-based authentication, or BBAuth: This is big. As Dave says, “If it’s easy to program, and delivers on what it says it does, this is a huge deal.” Agree or disagree with Dave, you have to listen. (see the YDN blog post and Dan Theurer’s post as well. It was Dan’s focus and tenacity that got this thing out. Thanks Dan!)
  • Yahoo! Photos API: combined with BBAuth, you can now write applications that have read/write access to users’ photos when they grant your application permission to work with their images. More on the YDN blog.
  • Upcoming PHP5 wrapper: Check out their post for all the details, but they delivered a PHP5 wrapper for their API and a couple of new method calls. Rock on (they’re hiring, too — Guitar Hero excellence preferred, but not required. Check out this photo of Beck with the giant Guitar Hero screen the Upcoming guys set up for Open Hack Day in the background).
  • Flickr support for JSON and Serialized PHP: Read all the details in Cal’s post to the yws-flickr group.
  • .NET Developer Center: A shout out to you Microsoft fans out there. Check it out.
  • Yahoo! Mail API: We gave everyone who came to Open Hack Day a crack at this API. Stay tuned for general release in a few months. This one is really exciting. Check out the story for where things are headed.

The Yahoo! Developer Network team and our partners in the product teams around Yahoo! rocked harder than Beck did on Friday night to get this stuff out and put on our Open Hack Day, so the credit extends to hundreds of people inside Yahoo! for getting it done and to all the incredible hackers who jumped right in, built stuff (often side-by-side with the developers who built the APIs they were using), and gave us immediate feedback.

I’m totally sleep-deprived right now, so I’ll save any extended commentary for later — but the past few days have been among the most memorable and exciting in my life. It’s been that good.

Berkeley-area doctors map mashup

Mashup screen I was sorting through some old papers and found one of those thick health care provider directories that you used to get when you started a new job with new health insurance. While most providers disseminate that information online now, the display of the information is often close to useless — you run a search and get dozens of providers back, and even if you can drill down by specialty, you’re still looking at a bunch of addresses with no sense of where they are relative to where you live. And who wants that kind of aggravation when you’re already sick?

To get ahead of the game (while I’m not sick), I created a Berkeley-area doctors maps mashup using screen-scraped data from my health care provider. I’m not a great interface designer, so it’s Web 1.0-certified, complete with frames. What the interface lacks in pizzazz, it hopefully earns back in simplicity: there’s a list of medical specialties on the left, and when you click on one, the providers that match that speciality display on the map in the window on the right.

Getting the data in shape was the hardest part, and required quite a bit of Perl elbow-grease with a little MySQL database design thrown in. From there, a little PHP hacking leveraging the Yahoo! Maps API and voila! That pediatric gastroenterologist that I hope you will never need is just one click away.

While the data part of this equation was difficult (it would have been WAY easier if this information was available via RSS), I think the utility of such an application made the data parsing worth it.

PHP/Perl programming language mashup!

(Via O’Reilly Radar) My friend and former colleague David Wheeler announced on Saturday that the new version of open source CMS Bricolage supports PHP templating via a new Perl module developed by George Schlossnagle. From the README:

This module provides a way to load a PHP interpreter into your Perl programs. The PHP interpreter then automagically has access to all of the modules and variables loaded into Perl. So PHP executed from Perl can use any Perl modules.

This is so cool and generally amazing (and it gave me the opportunity to debut the word “mashup” on this blog). When you’re remixing at the language level, you’re enabling all sorts of potential. Go Team Bricolage!