avatar

Life Programming

Simplifying infrastructure

Bringing DevOps to IndieHacking

I love the IndieHacking movement, and I noticed that there are people saying that they just edit their files on their servers, and that’s how they deploy their application. If some say it, they’re not the only ones to do it. Since I’m an SRE by day, I’m wondering if there would not be a way to bring some of the methods of my work to the world of IndieHacking.

Add a Server Struct for Better Handlers Management

On my previous post, I was explaining how to access a database from inside a HTTP handler in go using closures. While this method works, it comes with the disadvantage that if you want to access more than the database, you’ll have to add the new element to the list of arguments. In every single handler. On top of that, closures are not that simple to understand, and may lead to confusion.

Accessing your database from inside an HTTP handler in Go

Note: While this is interesting to learn more about creating closures, it was pointed out to me that there is a better way to do this. Look at this next post to learn more about it. Writing my last project backend in Go, I was confronted with how to actually write my HTTP handlers. The main issue I encountered was how to get the database handle in the handler so that I could actually use it for incoming requests. Since you usually have to respect a given interface, you cannot just add new arguments to the handling function.

Scrot useful options

When I wrote this post about installing KVM and virt-manager, screenshotting the windows that I was seeing was the easiest way to describe the steps to follow. On linux, one of the most used tools for that is scrot. As I used it in a few ways, I wanted to have a little reference, for the next times I have to use it. Basic commands 🔗The simple command will let you screenshot the whole desktop you’re currently on If you have multiple screens, this will capture only the current screen. To capture multiple screens, use the -m option.

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.

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.

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.

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.

Treesque -- A new name for a first project

Since my last post, I kept working on this new project, and made quite a good progress. So let’s welcome Treesque ! Go take a look, and give it a try. And if you like it, let me know on Twitter or by email. It is very basic at this point, missing a lot of functionalities, but it is a start, and I am happy to just have something out. It took a long time to get where it is today, because I had a lot to learn on the way, and I made some bad decisions along the way.

How I Want to Manage My Projects

Since I started working with a few project management solutions, I noticed that there are parts of them that do not suit me at all. I have been limited by those tools, because I could not see the project in a way that makes sense to me, or input more information in an easy and straigthforward way. I was not able to use these tools to think, and observe my thoughts objectively after. I would find them not simple to use, way too “clicky”, and not really versatile. They are a help to remember all there is to do (which may not be the best way to see a project), but I find them quite limiting