October 18, 2020

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. Read more

October 17, 2020

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. Read more

May 13, 2020

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. Read more

April 29, 2020

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 don't care how long I've been a developer. Read more

April 26, 2020

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 . '/' . Read more

Copyright Marin Gilles 2019-2021