If you’re a documentation nerd or somewhat planning to create content for publishing, surely you will encounter ASCII Doc. ASCII Doc is being use by different publishing giants like O’Reilly to create books and content.
One problem I encountered is generating HTML documents from asciidoc format. So how do I automate it?
Better to die fighting for freedom then be a prisoner all the days of your life.
— Bob Marley.
Ruby 2.5 and above
So how do we render HTML5 from ASCII Doc?
We proceed by getting all the required gems. The first step is get the file watcher to watch for changes.
In Linux, there are many ways to create a virtual file archive. A virtual file archive is a storage file which immitates an inode storage device, meaning its similar to what a physical drive can do but contained in a single archive. So how do we create this virtual file archive? What we will be using is the most primitive way to create a virtual file archive using Linux built in tool set.
The secret to happiness is freedom… And the secret to freedom is courage.
The tooling that we will be using is already built in Linux. To be transparent what I’m currently using is Arch Linux.
So what do we do now?
Create the file that will be using as file archive.
Setup a loop block device to handle input/output (emulating physical drives).
losetup /dev/loop0 gem.bin
Create the mountable directory.
mkdir -p /mnt/vfa
Mount the loop block device to the mountable directory.
mount -t ext3 /dev/loop0 /mnt/vfa
So guys, if you like this article hit like and subscribe. Hope you guys, enjoyed this article and as always live life!
losetup is used to associate loop devices with regular files or block devices, to detach loop devices and to query the status of a loop device. If only the loopdev argument is given, the status of the corresponding loop device is shown.
dd is a command-line utility for Unix and Unix-like operating systems, the primary purpose of which is to convert and copy files.
mount command serves to attach the filesystem found on some device to the big file tree.
XDG (freedesktop.org) which stands for X Desktop Group is a group which develop the X11 and xdg utilities which currently runs as barebones of linux desktop. So how do we change the defaults when opening a file on XServer?
Be free, and live life fully.
— Caroline Shaw.
So how do we configure XDG?
Tools that we will be using to configure xdg can be found in xdg-utils package (utilities like xdg-settings and xdg-mime). So to set the default application to open a certain mime type, you need run the code below:
xdg-mime default Thunar.desktop inode/directory
The command above would add the new mime application settings to ~/.local/share/applications/defaults.list. It basically tells xdg-mime to open a directory using Thunar (XFCE filemanager).
Installing MySQL2 gem became a common problem for people who uses macOS to develop Ruby1 based apps that utilized MySQL2 data store. I’ve personally encountered this problem myself back in the days and still encountering this on brand new setup macOS workstation. In this article, we will go through the steps I did to resolved this problem.
Tradition lives because young people come along who catch its romance and add new glories to it.
— Michael Novak.
We assume here you have some basic knowledge on setting up Ruby and command line tools on macOS.
Homebrew4 (Installed and no problems, run and check brew doctor for more info and if the installation is okay)
What did I do to solve the problem?
Here’s what I’ve done to resolve the problem.
First is to install openssl or gnutls (choose your poison). Both are great have some pros and cons but most people would use openssl and that’s what I preferred. brew install openssl
Then we point mysql2 dependency to the installed openssl package from Homebrew. bundle config --global build.mysql2 --with-opt="$(brew --prefix openssl)"
After all of that, we install the mysql2 dependency and all the sub-dependents that are needed. bundle install
That’s all needed in order to install mysql2 on a fresh macOS Mojave. Now you can develop ruby app that utilize MySQL as data store.
So guys, let me know if you encountered any problems? or any particular additional ways to install mysql2. That’s it guys hope you enjoyed this article and as always live life.
Ruby is an interpreted, high-level, general-purpose programming language. It was designed and developed in the mid-1990s by Yukihiro “Matz” Matsumoto in Japan. Ruby is dynamically typed and uses garbage collection. ↩︎
MySQL is an open-source relational database management system. Its name is a combination of “My”, the name of co-founder Michael Widenius’s daughter, and “SQL”, the abbreviation for Structured Query Language. ↩︎
Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. ↩︎
Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple’s macOS operating system and Linux. The name is intended to suggest the idea of building software on the Mac depending on the user’s taste. ↩︎
It’s 04:03 Tuesday, and I’m starting this blog. There are a lot of things currently bothering my mind, and sometimes I’m thinking of what the future will look like. Waiting till 10:00 to get onto my work and start doing some stuffs.
Let’s find some beautiful place and get lost.
I’ve been a senior software engineer for quite a long time and somewhat I’m in the midst of internal debate whether this type of work makes me happy. I want to work for myself and earn of what I can do, create and live on things I like.
So today, I’m saying I need to go and get what makes me happy. I don’t wanna grow old and regret a lot of things, go up the ladder and show them what you can do.