Replacing Eval with Object.send and a self written Parser

Intro A while ago, I was added as a curator for a Gem called JsonPath. It’s a small but very useful and brilliant gem. It had a couple of problems which I fixed, but the hardest to eliminate proved to be a series of evals throughout the code. You could opt in using eval with a constructor parameter, but generally, it was considered to be unsafe. Thus, normally when a project was using it, like Huginn they had to opt out by default, thus missing out on sweet parsing like this: $..book[?(@['price'] > 20)]. ...

May 28, 2017 · 7 min · hannibal

Furnace - The building of an AWS CLI Tool for CloudFormation and CodeDeploy - Part 4

Intro Hi folks. Previously on this blog: Part 1. Part 2. Part 3. In this part we are going to talk about Unit Testing Furnace and how to work some magic with AWS and Go. Mock Stub Fake Dummy Canned Unit testing in Go usually follows the Dependency Injection model of dealing with Mocks and Stubs. ## DI Dependency Inject in short is one object supplying the dependencies of another object. In a longer description, it’s ideal to be used for removing the lock on a third party library, like the AWS client. Imaging having code which solely depends on the AWS client. How would you unit test that code without having to ACTUALLY connect to AWS? You couldn’t. Every time you try to test the code it would run the live code and it would try and connect to AWS and perform the operations it’s design to do. The Ruby library with it’s metaprogramming allows you to set the client globally to stub responses, but, alas, this is not the world of Ruby. ...

April 16, 2017 · 6 min · hannibal

Furnace - The building of an AWS CLI Tool for CloudFormation and CodeDeploy - Part 3

Intro Hi folks. Previously on this blog: Part 1. Part 2. Part 4. In this part, I’m going to talk about the experimental plugin system of Furnace. Go Experimental Plugins Since Go 1.8 was released, an exciting and new feature was introduced called a Plug-in system. This system works with dynamic libraries built with a special switch to go build. These libraries, .so or .dylib (later), are than loaded and once that succeeds, specific functions can be called from them (symbol resolution). ...

March 22, 2017 · 3 min · hannibal

Furnace - The building of an AWS CLI Tool for CloudFormation and CodeDeploy - Part 2

Intro Hi folks. Previously on this blog: Part 1, Part 3, Part 4 In this part, I’m going to talk about the AWS Go SDK and begin do dissect the intricacies of Furnace. AWS SDK Fortunately, the Go SDK for AWS is quiet verbose and littered with examples of all sorts. But that doesn’t make it less complex and less cryptic at times. I’m here to lift some of the early confusions, in hopes that I can help someone to avoid wasting time. ...

March 19, 2017 · 9 min · hannibal

Testing new Hugo if posts are generated properly

Testing.

March 17, 2017 · 1 min · hannibal

Furnace - The building of an AWS CLI Tool for CloudFormation and CodeDeploy - Part 1

Other posts: Part 2, Part 3, Part 4. Building Furnace: Part 1 Intro Hi folks. This is the first part of a 4 part series which talks about the process of building a middlish sized project in Go, with AWS. Including Unit testing and a experimental plugin feature. The first part will talk about the AWS services used in brief and will contain a basic description for those who are not familiar with them. The second part will talk about the Go SDK and the project structure itself, how it can be used, improved, and how it can help in everyday life. The third part will talk about the experimental plugin system, and finally, we will tackle unit testing AWS in Go. ...

March 16, 2017 · 7 min · hannibal

Images on older posts

Hi folks. Just a quick headsup, that older posts and images, may have been lost unfortunately, because I made the terrible mistake, when I migrated over from my old blog, that I forgot to download all the images from the remote host. For lack of options, I deleted the images. :/ Sorry for the inconvencience! Gergely.

March 3, 2017 · 1 min · hannibal

How to HTTPS with Hugo LetsEncrypt and HAProxy

Intro Hi folks. Today, I would like to write about how to do HTTPS for a website, without the need to buy a certificate and set it up via your DNS provider. Let’s begin. Abstract What you will achieve by the end of this post: Every call to HTTP will be redirected to HTTPS via haproxy. HTTPS will be served with Haproxy and LetsEncrypt as the Certificate provider. Automatically update the certificate before its expiration. No need for IPTable rules to route 8080 to 80. Traffic to and from your page will be encrypted. This all will cost you nothing. I will use a static website generator for this called Hugo which, if you know me, is my favorite generator tool. These instructions are for haproxy and hugo, if you wish to use apache and nginx for example, you’ll have to dig for the corresponding settings for letsencrypt and certbot. ...

February 15, 2017 · 9 min · hannibal

How to do Google Sign-In with Go - Part 2

Intro Hi Folks. This is a follow up on my previous post about Google Sign-In. In this post we will discover what to do with the information retrieved in the first encounter, which you can find here: Google Sign-In Part 1. Forewords The Project Everything I did in the first post, and that I’m going to do in this example, can be found in this project: Google-OAuth-Go-Sample. Just to recap, we left off previously on the point where we successfully obtained information about the user, with a secure token and a session initiated with them. Google nicely enough provided us with some details which we can use. This information was in JSON format and looked something like this: ...

November 2, 2016 · 6 min · hannibal

RScrap scraper

Intro Hey folks. So, there is this project called Huginn which I absolutely love. But the thing is, that for a couple of scrappers ( at least for me ), I don’t want to spin up a whole rails app. Hence, I’ve come up with RScrap. Which is a bunch of Ruby scripts run as cron jobs on a raspberry pi. And because I dislike emails as well, and most of the time, I don’t read them, I opted for a nicer solution. Enter the world of Telegram. They provide you with the ability to create bots. You basically get an API key, and than using that key, you can send private messages, or even create an interactive bot which you can send messages too. ...

October 6, 2016 · 4 min · hannibal