I am not sure what it is with me, but I keep moving between self-hosted and hosted solutions. About a year ago I got rid of all my self-hosted services, and moved them all to hosted services. Nice, no more maintenance, nothing to break. No endless debug sessions right when you most desperately need access to one of your systems. Perfect. Till I was talking to a friend of mine the other day, he was…
Over the past few years there were several occasions on which I had to access the Analytics API using Go. This should be, and is, fairly simple. However, each time it took me too long to get it up and running. So for a future reference to myself, and for anyone else out there struggling with the Google Analytics API in Go, I wrote the steps down. So for this first step we need to set up Analytics…
Alright, time to deploy our application to some host. I often use DigitalOcean, but feel free to use whatever provider you like. As long as you’ve got SSH access, you should be good. If you feel like trying DigitalOcean, you can use my referral link to get a free $10 credit. Let’s assume we’ve wrote this wicked application, and we can’t wait to open the doors to this to the…
It’s been a while since I started web development with Go, and I’ve been enjoying it a lot. I’ve used mainly Echo and the well-known net/http library. However, today I am not here to talk about web frameworks, but about a templating engine instead. I like the default html/template package, but I am not very fond of it when it comes to bigger projects. Some things are simply…
Earlier today Atlassian announced Bitbucket Pipelines. It is basically CI built into Bitbucket. I gave it a try and it works perfectly fine for my not so extensive use case. When setting up Pipelines, the documentation has NodeJS, Java, Ruby, Python and PHP covered. Unfortunately Go is nowhere to be found. Don’t fret, we can do it ourselves :). Pipelines makes use of Docker images, so…
Time is of the essence. This initially started out as merely a few snippets of code regarding the formatting of dates, but then I decided that it is probably of more use if I publish it. I extended the snippets slightly, and added some examples of commonly used functionality within the time library. The reason why I have these snippets is because, well, Go’s date/time formatting is a bit…
Over the past few weeks I received the first batch of reminders regarding Let’s Encrypt certificates that are about to expire. I renewed the first few by hand, but surprisingly that get’s real boring real quick. Let’s fix this. I wrote a simple bash script just to do this for me, here we go: #!/bin/bash service nginx stop letsencrypt certonly --standalone -d machiel.me service…
Telegram introduced their Bot API a few months ago, and I started playing around with it. The result of my messing around was a very non-creative but funny baby: StrangerBot. StrangerBot – Chatroulette for Telegram. After one or two hours of hacking, I set this bot free to roam the world with the other Telegram bots. These ‘other’ bots were non-existant because it was about 24…
Go has an awesome feature built in, namely tags. You are probably already familiar with them, they are like annotations in Java for example. This is just a quick introduction: how to use them, and how to implement them. First of all, a quick introduction to tags. Let’s take a look at the encoding/json package. This package makes use of tags for the marshalling and unmarshalling of…
Just thought I would write a quick reminder on how to properly do string concatenation in Go. Every now and again I see string concatenation done like this: myString := myOtherString + anotherString. This is not the most effective way. Let me show you an example. Recently I quickly wrote a library to slugify titles for one of my personal projects. When hacking it together I used string…
Recently I developed StrangerBot, a bot built using the Telegram Bot API. It’s pretty cool. It got more than 10,000 users in a week. This bot was quickly hacked together, so I keep improving it and deploying fixes on a daily basis. I make use of channels that holds the received messages, and redeploying causes a loss of these messages. My application contains one goroutine, that continuously…
Do you recognize this question? You have a great idea for a new side project and after 100 hours of research and looking at benchmarks you’ve finally decided what programming language to use. Nice! Well done. So - now it’s time to search for a cool framework to use! Yay, big fun. So you start searching things like ‘best web framework for X’. Where X is the programming…
Recently I’ve been making a lot of use of the Play Framework, overall I am pretty satisfied, but Play makes use of a lot of static helper classes which quickly lead to tightly coupling Play into your code. For a while I have been trying to find out how to inject the EntityManager using Guice into my classes without having to call the play.db.JPA helper class everywhere. The reason? Simple, I…
Looking for a solution to pass enum values as Request Parameters in URIs using Spring is quite easy. However, my enum values are always fully uppercase. I do not like having capitalized characters in my URIs, so I went looking for a solution. It’s actually quite simple, first off you simply configure your route to accept the parameters. Here you’ll see how that is done, this is my…
Java is almost always giving me a bit of a hard time. I run into problems every now and then, so I start looking for answers on Google. Coming from PHP I am used to finding the answers within one query on your favorite search engine. However, with Java this is almost never the case. I always have to view at least the first ten results to forge the answer to the problem I am having.
Recently I started worrying about my privacy. ‘Just recently?!’, you ask. Yup, to be honest with you, yes, just recently. It started off with an advertisement for a VPN provider on the BitcoinTalk forums. Private Internet Access is the VPN provider I am talking about, and it truly works like a charm. I can recommend it to anyone. It has a great app for both my Mac and my Android phone.