Boris Buliga

Hello, my name is Boris Buliga. I am backend developer @Wix. I make the world better™ in Haskell, Emacs Lisp, Scala and whatever suits my current task. Most of my projects are open sourced and available on GitHub. Outside of the digital world, I am a tea addict, wine lover and a traveller.

Asking for input in Bash

April 12, 2019

Yet another tale about bash script refactoring. This time the configuration script of mirror-elpa had undergone some changes and I like the result so much that I decided to share it.

Imagine that you want your users to give you some input, for example, repository owner and name. And you want the value so desperately, that if the user doesn’t provide one, you ask the user again. On the other hand, you also want to support default values. So for example, if the user doesn’t provide any value, but there is a default value, you could use that.

And you can’t use anything except for bash.

Read more →

Revisiting Eru

November 4, 2018

As you might know, Eru is the supreme deity of Arda. The first things that Eru created where the Ainur. He then bade the Ainur to sing to him. Each Ainu had a particular theme given by Eru. Sure enough, Eru makes the ‘World and All That Is’.

So when I get a new clean system there is nothing yet. And so I call upon the wisdom and power of Eru.sh - the one who creates Ainur and the ‘World and All That Is’.

I just have to wait patiently, while everything is being downloaded and installed, while all configuration cogs are being placed on the right spot.

Read more →

Equality of booleans in Emacs

October 14, 2018

There is a fun story about booleans in Emacs Lisp - there are no booleans in Emacs Lisp. Sort of. Because we have a symbol nil, which means an empty list. You can write it as nil or () - they both stand for the same object, the symbol nil.

Since LISP is all about list processing, empty list is something very false. So false that we don’t have special symbol for false values, as empty list serves this purpose well.

Everything that is not an empty list has a meaning of true. However, there is a symbol t which is the preferred way to represent the truth value true.

So nil and t are considered canonical boolean values. There is a function booleanp that returns t if the argument is a canonical boolean value and nil otherwise.

The fun begins when you need to check if two boolean values are equal. Since non-nil (or not an empty list) can mean many different things (like "Emacs is the only true editor") you can’t just do regular equality check.

There are, however, several tricks to get it working. The most obvious solution is to convert value to a canonical boolean value.

Read more →

High quality GIF from video

October 13, 2018

When it comes to converting video to GIF, one usually gets a huge file and a questionable quality. Most of the guides suggest to use FFmpeg to do the conversion, but usually, they don’t bother with the quality of the result. As it turns out, folks from FFmpeg made some huge steps in improving the GIF output.

Read more →

flyspell-correct v0.5

October 7, 2018

flyspell-correct is a package for distraction-free words correction with flyspell via selected interface. It’s available on GitHub and MELPA.

Recently, there was a major release of flyspell-correct. Version 0.5 introduces rapid mode for fixing multiple words in one run, breaking renames and tests. Read further for the complete change list.

Read more →

Random bytes generation with OpenSSL

January 31, 2018

Sometimes you just have to generate some random bytes with high entropy. And OpenSSL can help you with this task.

Read more →

Structure templates in Org mode

July 30, 2017

Anyone would agree that typing #+BEGIN_SRC ... #+END_SRC blocks manually feels strange.

In order to make life easier, some people implement helpers to insert these blocks. For example, Chris Done has org-begin-template function in his configs. Other people use yatemplate to create generic or specific templates for blocks.

But what is most fascinating, is that org-mode bundles with templates for some structural elements like these blocks. And instead of copy-pasting solutions into your .emacs file, take a look at Structure Templates.

Read more →

AppleScript and the GitHub API

June 15, 2017

AppleScript is a powerful scripting language that allows to directly control scriptable applications and some parts of macOS. The language itself can be a little bit frustrating for those who are not familiar with natural language programming paradigm. For example, with AppleScript, you can tell application "Preview" to quit or ask someone to print pages 1 thru 5 of document 2.

But my goal is not to promote or demote AppleScript. Instead, I wish to share a little script that I’ve fetched while experimenting with OmniFocus 2. I hate to manually capture issues that I care about, so I started to work on a script that takes URL from an active tab in Safari and sends it to OmniFocus into the right project with useful title and body.

For example, I want d12frosted/flyspell-correct#30 to go into the flyspell-correct project with title and description taken from that issue.

Read more →

Fish: notify me when you finish

June 13, 2017

Have you ever been in a situation when you called git fetch, stared at the screen for several seconds and then switched to the browser to read something ‘useful’ while git fetches updates? And in five minutes you’re like ‘Oh wait, I was doing something important, no?’. Rings the bell, doesn’t it?

Read more →

Git: conditional configurations

June 11, 2017
(git)

More than five years ago Jeff King has added include directive to git config subprogram. This directive allows splitting configuration file across multiple files. A nice feature by itself was boosted in Git 2.13.0 by adding conditional includes - one of my favourite features of this release. And something that makes me sad.

Read more →

Deep in the black bashic

June 9, 2017

It’s been a while since my latest blog post. You know how it works, right? Family to care about, work to be done, places to visit, nature to explore, tea to experience, wine to enjoy, WoW to waste your time on… And then you think to yourself: ‘I want to write something to my long forgotten blog. Something that would interest at least someone’. And then you realise that your blog is ‘hosted’ on the cheapest EC2 instance and has terrible loading time. You try to fix it by moving to S3 with CDN, but you still have hakyll as a blog compiler and not everything works as you wish. You fix several minor issues and then you notice the part where you upload your blog using some black bashic, so you go to CodeBuild and CodeDeploy to automate everything and end up configuring Docker. You waste time and money, but comfort yourself saying ‘At least I am learning something new, something I can share with folks later’.

That’s how it works, isn’t it?

Read more →

Being an org-mode addict

December 20, 2016

It is funny how I vainly try to escape devilish org-mode. I have several major concerns regarding it as a GTD system and a note taking system, but after all, whatever I try to replace it with, I always return to org-mode. Mostly because it’s simple (at least at the top level) and makes me feel more confident about my thoughts, tasks and the future. But on the other hand, it makes me really angry because it forces me to make some uncomfortable decisions.

Read more →

Errors in shell scripts

June 27, 2016

Writing shell scripts might be pretty tedious because of all those failing commands leading to a corrupted state. And it gets even worse when you overpopulate your script with if statements which distract you from solving your initial problem. And fortunately, there are several neat tricks for handling errors in shell scripts that everyone should be familiar with.

Read more →

Using Spacemacs with several Emacs versions

June 24, 2016

Since Spacemacs officially supports at least two major versions of Emacs, as a collaborator I have to switch between Emacs versions time to time. And since installed packages don’t usually work between different major version of Emacs, I came up with a hack allowing me to seamlessly switch Emacs versions.

Read more →

flyspell-correct v0.1

June 22, 2016

flyspell-correct is a package for distraction-free words correction with flyspell via selected interface. It’s available on GitHub and MELPA.

Not long ago I have released the first version of flyspell-correct. There are several interesting changes compared to initial implementation. First of all, I divided this package into four different packages - core and interfaces. This allowed me to properly setup dependencies and also solved some problems with helm interface. Second important change - I’ve added a function called flyspell-correct-previous-word-generic, which is useful when the misspelled word is not under point, but long behind it. Right now I realise that it doesn’t work as perfect as I want, so I’ll improve it in the next release.

You can find more information about flyspell-correct on GitHub.

Read more →

Emacs and Composability

May 10, 2016

It’s not a secret that I enjoy using Emacs. And people often ask me why it’s Emacs and not Vi(m). The top issue for me is the modal editing thing. Somehow I just don’t get it. I understand that some people are able to fully utilize this feature, but I can’t say that about myself. In any case, recently I was reading an article on Irreal about Vim being not that hard to learn compared to Emacs and found a link to another interesting article about composability of Vim.

I totally agree that composability is a great feature that unfortunately wasn’t widely adopted. It’s very powerful in use and great in terms of learnability and consistency. Just as Mike Kozlowski has stated. I don’t want to repeat his article, instead just go ahead and read it.

What I want to do is to defend Emacs (and some other editors). I really think that it was very smart move to place the stake on the ability to extend the editor. And Emacs is a great example of such editor. Just take a look at evil. Whenever I think about it, I am amazed. It doesn’t mean that I want to use it, it just shows that extensibility matters and its limits are very loose.

Let’s return to composability in Emacs. One might argue that Emacs comes with built-in composability, but let’s be honest even if it’s not true - it’s still easy to implement vim-like composability even in Emacs. It’s just a matter of effort.

To follow Mike Kozlowski’s trend, I admit that Emacs is not perfect. Some people don’t like Emacs Lisp, and out-of-box experience is far from being ideal. In order to perfect Emacs The Editor you have to invest a lot of time in writing configurations. You also have to use dozens of third-party packages and also configure them appropriately. But it gives you freedom. And in case you don’t like writing configs, just take a look at these great projects - Purcell’s emacs.d, Prelude and of course, Spacemacs. You have plenty of options. And composability is one of them.

Read more →

flyspell-correct

May 9, 2016

flyspell-correct is a package for distraction-free words correction with flyspell via selected interface. It’s available on GitHub and MELPA.

It’s very common to make mistakes while writing notes, comments or whatever. And a desire to have spell checking software is natural. In Emacs, we usually use Flyspell for that purpose. It’s a great piece of software, but sometimes it lacks better interface for correcting words. Especially since there are completion packages like popup.el, helm, ivy etc. There are already available separate packages for correcting words via popup.el (wiki, flyspell-popup) and helm (helm-flyspell). Since recently I have switched from helm to ivy, I’ve found a lack of similar package for ivy, so I decided to write my own.

But available packages are all the same, except the part that calls completion front-end, so my goal was to provide a generic package allowing usage of any interface. Either from the predefined set (ivy, helm, popup or dummy) or any user-defined.

This is an introduction post, for more up-to-date documentation, please refer to README file.

Read more →

Cabal and executables

April 5, 2015

Maybe I did something really wrong in my life, because I constantly run into Cabal Hell. That feeling of powerlessness is refreshing, though depressing. And I hate it the most when I just need to install an executable from Hackage, like pandoc.

But hey, we are software engineers after all. So I decided to write a little helper script to avoid world destruction and get desired executable in my $PATH.

Important note. In the last few years Haskell community did a great job in order to fight the Cabal Hell. And thanks to Stack and Nix-style Local Builds my solution is no longer required. I keep it just for historical reference (and to keep my blog relatively busy).

Read more →

Make the Fish fly

February 7, 2015

I have always been inspired by the people who use (or at least can use) terminal for any kind of activity that is associated with programming. Sure, every task has its own set of instruments to be solved with. But there are instruments that you can count on in almost any situation. That’s why I spend so much time in the terminal.

For a long time (like a year and a half) I was using zsh beefed with oh-my-zsh. While it was providing me a lot of crucial functionality, I wasn’t very happy about oh-my-zsh, so when someone mentioned fish in comments to Use Haskell for shell scripting thread on Reddit, I decided to give it a try after few minutes of reading how awesome fish is.

In this article I am going to share my thoughts after using fish. But keep in mind that this is not a tutorial to fish (mostly because it already has a good written one, which covers most important aspects of day-to-day fish, but you might also want to read full documentation to get the full grasp).

Exploring new stuff is fun. So even if you are totally happy with your setup, I highly advice you to take a look at fish.

Read more →

CanonicalPath v0.3.0.0

February 4, 2015

Recently there was the third major release of CanonicalPath library introducing some good stuff, but unfortunately breaking API (just a tiny little bit).

New version is available on Github, Hackage and Stackage.

Read more →