while(motivation <= 0)

Back
Adventures in C++ SDK hell
So two weekends ago I decided to try to get my twitch bot Raphael working on Windows. It didn’t take much to get it fired up, but I quickly discovered that the performance was terrible. In order to try and solve this issue I started investigating how difficult it would be to write portions of the bot in C++ to try and achieve the same or better performance over what I see in Linux. Asking ChatGPT made the prospect look to be within reach so I set about implementing Raphael in C+++. The rest of the first weekend was spent trying to get the AWS C++ SDK to compile and build. That following Monday I was able to get the SDK to build, but it never stopped complaining about parts of it being missing. This weekend I tried taking a step back and seeing about getting individual components to work. PortAudio which is the leading solution for working directly with Audio with C++ was no trouble at all. I then landed right back with my new nemesis the AWS C++ SDK which even with all of the examples available, I haven’t been able to get any piece of the AWS SDK working. This was quite a surprise as the boto3 aws sdk for python is fabulous and works right out of the box with barely any set up. I’m not sure if this project is beyond my skills and patience but more investigation is needed. Everything I’ve come across for working with c++ requires you to build, compile, and implement the references in CMAKE which has had quite a bit of a learning curve.
Adventures in PHP

This week has seen a lot of my spare time trying to finish solving a problem I encountered at last weekend's tail end. Why my EC2 vm with an IAM profile that should grant it access to an s3 bucket can’t use the AWS PHP SDK to connect to the S3 bucket. I kept getting variations of this exception:
 

[Fri Jun 28 22:47:50.774779 2024] [php:error] [pid 38165] [client 1.2.3.4 :34135] PHP Fatal error: Uncaught Error: Unknown named parameter $instance in /home/notarealuser/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php:74\nStack trace:\n#0 /home/notarealuser/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php(74): call_user_func_array()\n#1 /home/notarealuser/vendor/aws/aws-sdk-php/src/ClientResolver.php(263): Aws\\Credentials\\CredentialProvider::defaultProvider()\n#2 /home/notarealuser/vendor/aws/aws-sdk-php/src/AwsClient.php(158): Aws\\ClientResolver->resolve()\n#3 /home/notarealuser/vendor/aws/aws-sdk-php/src/Sdk.php(270): Aws\\AwsClient->__construct()\n#4 /home/notarealuser/vendor/aws/aws-sdk-php/src/Sdk.php(245): Aws\\Sdk->createClient()\n#5 /var/www/blog/s3upload.php(35): Aws\\Sdk->__call()\n#6 {main}\n thrown in /home/notarealuser/vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php on line 74


 

I didn’t want to but I ended up adding the aws cli to my test box and confirmed that I could indeed access my aws bucket without using any hard coded credentials on the box using the IAM profile for the ec2 running this code. I ended up calling the AWS CLI from my code directly. This isn’t ideal, but I’ve wasted enough time this week fighting with this bug. In other news ChatGPT is pretty fantastic at writing regular expressions and translating english into sed commands for processing text data. Because I had to use the AWS CLI, I was getting the contents of my S3 Bucket back as text that wasn’t in a format that was ideal for consuming by code. Here is the prompt I used and the response.

chatgpt doing the hard part

I validated that the sed was correct on the website https://sed.js.org/

sed validation tool online, very cool

ChatGPT also provided a useful breakdown of the sed command that it wrote. explination of sed command

One more tool for my toolbox for working with files in nix environments.