Mauriat Miranda     mjmwired

Go Hugo

*tap* *tap* is this thing on?

So after a great deal of internal debate, I ditched server-side LAMP based blogging software and migrated to a statically generated system, namely Hugo. Ultimately the decision came down to maintenance. I was creating content at a lower rate than Wordpress (and its plugins/themes/etc.) required updates. Nevermind the need to keep the server software (Apache, MySQL, PHP) secure and updated as well.

Even though the migration was painful and the new system can be restricting, I’m glad I did it. Ultimately Hugo is a great resource for producing technical documentation quickly and having the content last indefinately.


I used exitwp-for-hugo which converts a Wordpress export into MarkDown files compatible with Hugo. In retrospect this was a bad idea. Not only did I have to tweak the code to get my content right, I still had to manually adjust a large number of files for markup issues and then write additional code to manually add the categories.

My recommendation: is to write some custom PHP or Python code with some SQL to just export all past content as HTML and use unsafe = true under [markup.goldmark.renderer] to render it. Then write only your future content in MarkDown (or if you must revisit a past post, manually update it).


I know community participation is important but given my update frequency, I’m just not going to deal with comments for now. I’ll revisit in the future.

I didn’t really see a common convention for comments in Hugo. In my above Python code, I just decided to extract comments into a YAML array and store them in the front matter as comments parameter for each file. Then in my template I iterated through them. I don’t know if this was the right solution and it looks messy, but it worked well and I don’t intend to do it again.

Example markdown parameter:

    id: 123
    author: somebody
    date: 2012-06-11 06:16:49
    content: "thank you that works!"
    id: 145
    author: BobSmith
    date: 2012-06-21 07:28:25
    content: "Comment with html.<br>Thanks for the post."

Example template snippet:

  {{ if .Params.comments }}
    <p>{{ len .Params.comments }} Comments:</p>
    {{range .Params.comments}}
      <li><h6>{{ .author }} on {{ dateFormat "January 2, 2006 ~ 03:15 PM" .date }}</h6>
      <p>{{ .content | markdownify }}</p></li>


I’m waiting for all the 404 errors to show up so I can write mod_rewrite rules to redirect. The cool thing about Hugo is all ~1,700 html files render in less than 200ms! So its quick to patch an error and push updated files. And the resulting static content can be deployed on practically any webserver with minimal work.

Future Learnings/Updates

While writing content is quick and easy, tracking it and filtering the meta data can be a bit confusing. I’m sure there are tips and hints out there to help. For now I’ll assume that tags and categories may be quirky.

I still have a long list of tweaks needed for the output side as well.

  • I need to find a better Contact method. I’ve been terrible about this, but you can find me on twitter or figure out my email rather easily.
  • The styling needs some creativity (I do miss my old blue).
  • Still lots of “\” and unicode conversion issues.
  • Related: I would like to possibly release a custom theme for Hugo. None actually appealed to me and I wanted something simple.

On a personal note, this undertaking was spurred by being forced to work-from-home due to Covid-19. I am really glad that I found something to put my energy into. I look forward to publishing some technical content (and personal posts as well) in the near future.

Posted in: Website,

Migrate from Perforce to Git

I had been using Perforce for revision control mostly for Windows and binary files (excel, PDF, etc.). It worked amazingly well and had a powerful GUI! However I finally decided to consolidate on Git.

Primary instructions are from git scm

In CentOS you will need the helper package:

$ sudo yum install git-p4

The following steps worked perfectly for me.

  • My Git projects are in ~/git (where the converted project will end up)
  • My Perforce server is on atlas
  • I use ~/work as my working directory (where I clone, checkout, etc.)
[mirandam@atlas ~]$ mkdir ~/git/p4proj
[mirandam@atlas ~]$ cd ~/git/p4proj

[mirandam@atlas p4proj]$ git init --bare
[mirandam@atlas p4proj]$ cd ~/work

[mirandam@atlas work]$ export P4PORT=atlas:1666
[mirandam@atlas work]$ p4 login
Enter password: 
User mirandam logged in. 

[mirandam@atlas work]$ git p4 clone //depot@all p4proj
Importing from //depot@all into p4proj
Reinitialized existing Git repository in /home/mirandam/work/p4proj/.git/
Import destination: refs/remotes/p4/master
Importing revision 189 (100%)

[mirandam@atlas work]$ cd p4proj

[mirandam@atlas p4proj]$ git remote add origin ~/git/p4proj
[mirandam@atlas p4proj]$ git push origin master
Counting objects: 2268, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (770/770), done.
Writing objects: 100% (2268/2268), 159.98 MiB | 128.79 MiB/s, done.
Total 2268 (delta 1272), reused 2268 (delta 1272)
To /home/mirandam/git/p4proj
 * [new branch]      master -> master

Now in my work directory I can perform changes and continue working.

Posted in: CentOS, Development, Git,

Migrate from Mercurial Hg to Git

I had one last Mercurial project that I still actively developed. Everything new I’ve completed restarted with Git but this was a last hold out.

I blindly followed this Stack Overflow answer which says to use fast-export. However I ran into the following problem, and the Stack Overflow answer didn’t help much.

$ git push origin master
remote: error: refusing to update checked out branch: refs/heads/master
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '/home/mirandam/git/project'

After some trial and error, the following steps worked exactly how I expected.

  • My Git projects are in ~/git (where the converted project will end up)
  • My Mercurial projects are in ~/hg (this is where the project to be converted will live)
  • I use ~/work as my working directory (where I clone, checkout, etc.)
  • I use ~/tmp as just a scratch temporary directory
[mirandam@atlas ~]$ mkdir ~/git/project-new
[mirandam@atlas ~]$ cd ~/git/project-new

[mirandam@atlas project-new]$ git init --bare
[mirandam@atlas project-new]$ cd ~/tmp

[mirandam@atlas tmp]$ git clone git://
[mirandam@atlas tmp]$ cd ~/work/

[mirandam@atlas work]$ git clone ~/git/project-new
[mirandam@atlas work]$ cd ~/work/project-new

[mirandam@atlas project-new]$ ~/tmp/fast-export/ -r ~/hg/project-old
[mirandam@atlas project-new]$ git checkout HEAD
[mirandam@atlas project-new]$ git push origin master

Now in my work directory I can perform changes and continue working.

Posted in: CentOS, Development, Git,

CentOS Server and Desktop Updates

I’ve been using my previous hosting provider (PowerVPS) for over 10 years now! They had incredibly reliable service so I never switched. But for the past few years so many smaller companies have been providing much more competitive options. However I was just too lazy to make the switch.

Just for fun: the last tweet by @PowerVPS was to me from the last time I purchased a server from them!

@mauriat I’m glad it was an enjoyable 5 years, we wish you the best. Let us know if we can ever help again.

– PowerVPS (@PowerVPS) April 14, 2011

The mistake I made was setting up a server with CentOS 5 instead of 6 at the time. So now, almost everything is way out of support.

I decided I did not need all the features a full VPS with CPanel provided (primarily a full web based administration tool and countless plugins). I know I have enough experience just to setup the critical things I cared about. After some research I decided that Linode (*) was the best balance of price and features. The best part was I could pick a clean minimal install of the latest version of CentOS!

So it took me about 2 weeks to get everything working and I still have some sites to migrate but for the most part I’m very happy with what I’ve got working. I fully intend to write up a lot of this stuff and share it.

  • All server software is from up-to-date binary packages from reliable repositories. (No more manual compiles of Apache, etc. just to be current)
  • I switched all my site development code to be deployed through a combination of ssh and git (more on this later)
  • I have fully switched over to secure sites! Have https on almost everything! Courtesy of Let’s Encrypt
  • Everything runs so much faster and smoother than I ever had in the past 5 years!

On the desktop side, I finally switched my main Linux desktop to CentOS 7 - a whole year after I intended to do it. But that really is a good thing since my CentOS 6 setup was so solid that everything worked. I was just getting tired of not being able to try out new software (more on this later). I did update to Windows 10 as well and have been playing with the Ubuntu Linux system embedded in Windows, and I must say I’m really impressed (more on this later as well).

So I’m ashamed that I stated over a year ago that I would resurrect this blog! But a recent kick in the pants finally got me working on cool stuff that I’ve always enjoyed. Greatly looking forward to writing up a lot of the stuff I’ve been working on!

(* Linode is a referral link)

Posted in: CentOS, Desktop, Hosting, Linux, Server,

Resurrecting my Linux Blog

The last 4 and half years had left me with no spare time to pursue my interests in all things Linux. Recent career choices have given me the breathing room to change that. I intend to bring up my site back to what I’ve always wanted it to be: useful to me and hopefully useful to others.

Lots has changed in the linux and open source world, but even so I’ll slowly start contributing again. (I’m really rusty)

To the countless people who have emailed me and I never replied, I am truly sorry. Thank you to all those who have sent private words of encouragement.

Posted in: Linux, Miscellaneous,