KidSpeak in Lund

This has been one crazy busy year! I have been doing a lot of intense client work with GraphQL, React and Redux, along with interviewing a lot of people looking to join tretton37. On top of that, I have been working on some personal projects which I am hoping to reveal later this year!

The official KidSpeak event website has been launched at Kidspeak.se where you can now sign up for the event being held in Lund, Sweden, on the 22nd of July (2017). There will also be a Stockholm event announced in the next couple of days, we are just trying to make it fit around people’s vacations. These events will be a repeat of what was held at Leetspeak 2016, however there will be something completely new at Leetspeak 2017! Lots more great things are coming, so stay tuned!

Some may have noticed that I have not been exactly the most active person on making posts on here lately. The biggest reason for this is not due to a lack of having things to talk about, but more of a struggle on finding out how to seperate what is personal, what is professional, what is a project, etc. I tried to fit too much onto this one website and it began to make me second guess everything I would put up here.

After having spoken to a friend, I decided to create another website Justinel.com where I have begun to post some initial content. I intent to continue sharing code snippets, and regular blog posts here on Cyber-Lane, whilst the new website will contain links to mini projects and experiments I have done, along with products I look to sell in the near future.

This small seperation has made my mind a LOT easier, and I feel I can now think more about producing content and just getting it out there. The moment I find something does not fit in either, I will make another site. Let’s see how this goes!

On another note, I am working on running some more Kidspeak workshops this year. There will be one down in Skåne and another in Stockholm (details coming soon), and then of course I will be at Leetspeak once again.

Why Cloudflare gives error 522 to my NodeJS app

Last week I started to make use of Cloudflare for my DNS on a few of my domains, including my Dynamic DNS. When I wanted to start using HTTPS on the NodeJS app I hosted at home though, I ran into error 522.

To diagnose the actual error code (as Cloudflare just showed you their standard error page), I used the following command:

curl -svo /dev/null my.domain.com

Which identified the error to be 522, to me. Originally, I was confused about this error, as when I turned off HTTPS on Cloudflare, I could access my app via port 443.

After digging further into the issue, I was getting nowhere and decided to try something out of pure curiosity. I decided to make my NodeJS application accept requests from both ports 80 and 443. I did not want to support non-SSL, but I decided to try this anyway. I made the change, I waited 10 minutes to make sure it went through, I tried again, and like magic it was working! I spoke to one of their technical support staff who later revealed to me (not mentioned in their documentation), that their service will send SYN commands to your domain and await a SYN-ACK in response. This all happens on port 80, and upon receiving those, it will open up the SSL traffic, and redirect all traffic via port 443!

If I was actually using nginx or some web server, rather than self hosted, it would have handled this all for me, but since my app was a simple Slack bot, I did not want to install the world on my box at home. The problem is now solved, and I learned something new.

My hope is that anybody else doing self hosted NodeJS (or anything else) at home will benefit from this post, and not waste an entire day looking into the issue as I did!

Cloudflare Dynamic DNS

I use Cloudflare for the DNS on my domain, which lends me a number of useful features, incuding SSL. I wanted one sub-domain to work as a Dynamic DNS for my computer at home, so I wrote a script to do exactly that.

Cloudflare Dynamic DNS is a NodeJS script which when started will keep on running and at 9am every day it will check your public IP and update your sub-domain on Cloudflare accordingly.

It’s a really simple script, but since I use it and find it useful, perhaps somebody else will find it useful. I don’t normally bother with licenses but am aware that some people are skeptical about using software which does not have a license, so I added the MIT license.

Enjoy!

Finding MSBuild with Windows Batch files

Lately I have been doing less and less C-Sharp code, and the times I do have to dive in, I try to use CAKE or another some similar system for my build scripts. However my current client has a personal preference of using Windows batch files, which is fine until it looks for a version of MSBuild that I do not have installed!

An example of how existing script files may look would been

@echo off "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" SampleProject.msbuild

Now if I had MSBuild 12.0 installed, that would not be a problem, however I have version 14.0, so I have started changing the scripts to look a bit like this

set msbuild.exe=
for /D %%D in (%SYSTEMROOT%\Microsoft.NET\Framework\v4*) do set msbuild.exe=%%D\MSBuild.exe

if not defined msbuild.exe each error: can't find MSBuild.exe & goto :eof
if not exist "%msbuild.exe%" echo error: %msbuild.exe%: not found &goto :eof

@echo %msbuild.exe% SampleProject.msbuild
pause

:eof

I came across the code for this on StackOverflow.