projects | blog


[all the things] [rss]

November 27, 2020 1:52 PM

Using the DigitalOcean Spaces API

This is a very long post. So long that I cut off the post unless you look at the individual entry page for this post. I doubt anyone would care to read this, unless someone is interviewing me for a job, and they want to know how I approach problems. So, read it if you want.

So, I have a bunch of pictures on my wordpress site that I need to port over to my Spaces CDN. I've got a script that parses an XML wordpress export, and any time it runs into an image, I need to:

Simple enough. So what I did was take each image, and extract the path out of it. So for this url https://meyzdaisy.files.wordpress.com/2019/01/img_0308.jpg, I'd need the 2019/01/img_0308.jpg part. I have a bucket that I store all the files in, and each file is accessed using a key. I created a folder in my bucket just for these images that are coming from my WP site called from-wordpress. And with this, the key for this particular image would be from-wordpress/2019/01/img_0308.jpg

Now to use the Spaces API. If you read their documentation, you'll notice that they have examples in JavaScript, Go, Python, PHP, and Ruby. No Perl. Of course there's no Perl. A quick google search for "DigitalOcean Spaces Perl" doesn't seem to come up with anything. Sometimes I think, man it would be so much easier if I just learned Python and used that instead of Perl. But I am a Perl programmer and I will figure this out.


July 16, 2020 10:01 PM

Fixing my ascii art chick

Since coming back from my vacation, I've been trying to limit my exposure to other people. I realized that in my whole life I don't think I've gone two days without interacting with someone else in person. So this is weird. I'm forcing myself to stay at home except for going on runs outside (I need fresh air and exercise), and I don't even do that every day. So far this is working out okay. Each night, I write down a TODO list of things I want to accomplish the next day. I almost never accomplish all the things, but hey, I'm staying busy.

Today I told myself I was going to figure out how to include images in the blog entries occasionally. But then I looked at my site on mobile, and I turned my phone sideways. And you know what I noticed? The little ascii art chick on the front page was all janky looking. But it only happened when I turned my phone sideways. Looked perfectly normal with the phone in the vertical position. I tried to reproduce this in my Chromebook and no matter how I resized the window, it didn't happen. Also, trying to "debug" an issue on a phone is a pain in the butt.

But, somehow I was able to fix it. First I tried Googling, and found some promising looking StackOverflow questions about people having trouble with monospace fonts on mobile, but it turns out those people wanted to use box glyphs and my ascii art is well, ascii. So I zoomed in on the ascii art chick on my phone and highlighted the area. The spaces in front of certain lines were narrower than others. Why? Who the heck knows. I did the same thing on my computer and inspected the space element with the dev tools. I inspected other space elements. And I realized some spaces were inside <span>s and others weren't. So I made it so all the characters in the ascii art section were surrounded by <span>s, and it fixed it!

-  <pre>
-     <span class="yellow">.--.
+  <pre><span class="yellow">
+     .--.
     ;   </span><span class="lightblue">@</span><span class="yellow">&#92;
-    ;    :</span><span class="orange">&#62;</span>
-   <span class="white">/\/\/\/&#92;
+    ;    :</span><span class="orange">&#62;</span><span class="white">
+   /\/\/\/&#92;
    \      /
     '----'</span>
   </pre>

Yeah, it was kind of dumb. I spent like an hour and a half looking at this. And I never got around to incorporating images in this post. Which would have been helpful. Oh well. Next time.


October 13, 2018 10:12 AM

Writing code is fun

Guys, (I know, no one reads this, who am I even addressing here?) I read and modified some code today. And it was fun. I love writing code. I think computers are awesome. But sometimes in the grind of work and trying to do everything in the best way possible, I forget that.

So last night I was trying to add some tests to my Teochew web app, and it was getting kind of tedious, so I wanted to take a break. I also needed some way to know that I still need to finish these tests. For this whole project, I've just had a single text file that I add notes to, but lately I've been wanting something more sophisticated. I wanted a real bug tracker. I had tried the bitbucket issue tracker, but I thought it was annoying to have to actually log into bitbucket in my browser. I decided to look for command line issue trackers, and I came across bitbucket-issue-manager.

I initially thought it just looked really spiffy, so I installed it. Then I realized I needed nodejs, and then I realized my version of Ubuntu is no longer supported, so I had to upgrade that. That was a long process of installing things, and reconfiguring things, but fast forward and I have the issue manager tool installed! Of course I go to run it and I realize there's a typo in the command name (already previously noted in an issue on the github repo). So I go mucking around renaming the command in my system. And I finally get it all to work, but I realize there are things I'd like modified in this tool.

But it's nodejs! I've literally never touched nodejs code before. Well, before today. Anyway, I decide to clone the repo and modify it. Turns out, nodejs is pretty easy to read. I modified the code to make the issues display the way I want, and it was really satisfying and it reminded me of how awesome the concept of "typing words on a computer and having things magically happen" is.

I actually wanted to modify the typo in the command name, but I didn't even see the typo in the code in the repo, so perhaps that's already been done and the package on npm hasn't been updated? That's a lot of other stuff that I don't understand. Well if I modify something in a useful way, maybe I'll see how the whole pull request thing works.


<< More Recent