Tiling Images With Imagemagick

While writing this post about installing KVM and virt-manager, I wanted to show multiple steps of a process by capturing the window for each screen. Getting the images was quite simple, but including them one by one in a blog post seemed a bit tedious, even though there were only 5 images. Especially given that including images in markdown seems… impossible ! I knew about imagemagick before, but had never really used it, or went to see into the documentation. After a little research, I found the montage command, which allows you to create a composite image by combining several separate images. ...

April 29, 2020 · Marin Gilles

Renaming files in Vim: A Vimscript experiment

I took an attempt at creating a Vimscript function to rename a file with a simple command. It was not that hard, but there are a few tricks that you need to learn to get started writing Vimscript. Let’s first look at the full code for the function, with a mapping to <leader>fr function! s:RenameCurrentFile( newName ) let l:file = expand('%') let l:currentFilePath = expand('%:p:h') let l:newFile = l:currentFilePath . '/' . a:newName " Save new file execute "saveas " . l:newFile " Open new file in a new buffer execute "e " . l:newFile " Kill old buffer execute "bdelete " . l:file " Remove old file call delete(l:file) endfunction command! -nargs=1 -complete=file RenameCurrentFile call s:RenameCurrentFile(<f-args>) nnoremap <leader>fr :RenameCurrentFile The first thing that had me bumped was how to use saveas. You have to execute a string that you create with the proper arguments, and there is no function for that. All commands that you would type after a colon (like edit, or bdelete, in this example) will have to be executed this way. ...

April 26, 2020 · Marin Gilles

Installing and running libvirt and virt-manager

I wanted to start using Vagrant, to create a virtual machine that would allow me to test different ArchLinux install scripts, window manager settings, etc… without messing up my machine. That would make me start by loading the archlinux/archlinux box with the libvirt integration, which needed me to install libvirt. I wanted to use KVM as an hypervisor for that, so I needed to install QEMU for it, since KVM is a special operating mode of QEMU. ...

April 19, 2020 · Marin Gilles

Download Torrents From the CLI

I wanted to download the ArchLinux ISO image from here. It is advised to download it using torrent. We’ll be using aria2 for this. I am running Arch, so to install aria2 pacman -S aria2 To start the download, just run: aria2c <torrent or magnet link> That’s it. Once the download is complete, the file(s) will be in your current directory. There are other options to manage torrents from the command line, such as: rtorrent transmission-cli deluge-console For a single torrent download, aria2 does the job well, and very easily. I’d look into the others for more advanced torrent management. ...

April 11, 2020 · Marin Gilles

My simplified development workflow in Go

Using tests during development to keep you code tidy As I was working on a project, while developing a new function, I noticed that I was modifying some existing code to be able to test it. Doing it this way seemed like a very bad idea, so I looked for a better way to do it. But let’s start an insanely simple example, to clarify what I’m saying. We start with a basic program, an extraString function and a main. ...

March 21, 2019 · Marin Gilles

Automated vs Manual

We always speak about automating everything, especially in the tech world where everything goes so fast. And I agree that if you can, you should automate processes as much as you can. But there is value in doing things manually sometimes. The first value is for learning. If you are learning a new technology you will have to put the work, and manually tweak code, settings until you really understand how it works. Without going through the process, you will just scratch the surface of what you are learning. ...

September 19, 2018 · Marin Gilles

New Virtual Appliance From an Existing One With Packer

When deploying Virtual Appliances (VA), you want the process to be automated and repeatable, not just a one shot configured and exported manually. Thanks to Packer, automating this is just a question of creating a JSON configuration file and letting it do its magic. Packer is used by giving it an ISO image of a base distribution, installing the distribution and running the modifications you want. This is good when creating new VAs, but what can you do if you already have an existing one? ...

September 13, 2018 · Marin Gilles