CODE::DIVE 2017

This is small blob of text about my experiences at CODE::DIVE 2017
I’ll add video links to the talks when they are posted online

Preparation

So we ended up at CODE::DIVE because one of my classmates went like ay you know what we should hit up CODE::DIVE in poland next month. We where skeptic at first because our college and planning is mostly a no-go but this time we had a teacher on our side that was also joining. So after some planning and getting our registrations finalized we had a stable plan of skipping 4 days of college and going to Poland.

Travel

We hired 2 vans to drive from Utrecht(The Netherlands) to Wroclaw(Poland) and pickup our teacher and a student that where in Berlin for a different conference. It was planned to be a 11/14 hour car ride and have some stops in between to switch drivers.
The ride it self was quite nice although we left a bit later than expected and during our travels we might have ended up in some random forest close to the border of Poland. but end good all good we arrived at our hostel (five stars hostel) and unpacked our bags and got ready to have some dinner at 10pm.

Wroclaw && shots

After having a nice pizza in the city we joined up with some fellow CODE::DIVE goers and some speakers as well. We went to a random pub with loud music and I might have ended up signing abba - dancing queen during kareoke. We just threw some money at a guy and we came back with 25 beers and around 40 shots ranging from quite sweet to what the fuck is this flavor(They said it was cookie :|). Our pub crawl stopped around 2am and went back to the hostel for some good sleep because presentations start at 9:15. Apart of some annoying loud drunken polish people underneath our window I got a nice steady 2 hours of sleep :|.

Agenda and my decisions

Me and some of the students with similiar interests decided to make a planning for the 2 days so we don’t run around like headless chickens trying to decide which talk to go to.

Day 1:

Fpga for software developers

I arrived a bit late to the talk because it was so early and the bed was quite comfy.
So I ended up sitting on the stairs with the rest of my group watching the talk. The talk was quite fun he basically had a fpga devboard and showed in a decent speed how to make a 8bit cpu on a fpga. How to create an instruction set and how to program a fpga. The ending demo was quite sad cause it was a tiny fpga board with a counter that resets when a button is pressed.

Faces of undefined behavior

So this talk was really fun he generally talked about UB(Undefined behavior) and how our active defenses against it can actually end up ruining code and generate harder to find bugs. Because when you preemptively try to disguise UB static analyzers will mostly overlook the situations and it might just show up randomly when already deployed. He also showed how the new contracts and some future methods can make it more certain that the user/developer keeps up the contract and doesn’t introduce UB. and maybe even some new attributes you can use in the code that will only check it when you run it over the static analyzer but expects it to work when you normally compile and run it.

C++17 and beyond

Overall fun talk and a great speaker props to Mark Isaacson he was probably my favorite speaker from the talks I went to. During this talk he talked about the new features in c++17 and c++20. He gave a quick 1 sentence explanation of the new features he likes the most and after that he went into more depth about
std::string_view. On what uses cases it has and when you should use and shouldn’t use it.

Howling at the moon: lua for c++ developers :(

I expected some fun lua and c++ combinations but it ended up being quite a drag.
It started with a very very basic intro to lua and was more catered to the people that never saw lua EVER.
So I immediately zoned out and when I looked up I saw templates and other kinds of stuff so I guess it got interesting but maybe nicer to just watch the talk online.

Day 2

;TlDR; about the talks

End note


Branch abuse

Rapid prototyping and branches

So I wanted to write a quick post on how I started abusing my git branches for prototyping multiple implementations.

And using different frameworks or even parts of the project .

Project structure

So my project shockthewolf has 3 major parts.

  • IOT esp project - sketch, c++
  • Backend server - python?, node?
  • Frontend web UI - javascript, etc.

Current Branches

  • MQTT - a mqtt implementation of the IOT functionality using sming
  • WS - a websocket implementation of the IOT functionality using sming
  • HTTP - a http implementation of the IOT functionality using sming
  • Platformio - My first implementation of my IOT functionality using platformio and esp8266 webserver
  • WEB - First start of the frontend system

Previously I just used my branches for features or releases (yes I know tags should be used for releases)
But since I wanted to just write my stuff as quick as possible and save it somewhere I went on creating branches.

For example I was writing my http implementation in platformio but also Wanted to write the same thing in a new framework I discovered. I had no intentions of poluting my git space with anymore repos for my quick implementations.

Create all the folders

So I just did mkdir sming_http went into the folder and git init.
Started writing my program and at the end of the day I wanted to save it somewhere.
Knowing I would get conflicts if I would keep it on my master branch I just renamed the current branch to HTTP. git branch -m master HTTP. add my origin git remote add origin <repo url> and git push origin http and my work was happily saved on my remote repo in it’s own branch.

It first felt like a hacky way of saving stuff but after using it for a while I started liking my methods. Of just easily creating a new project that had something to do with the repository and push it onto it’s branch and treat as separate projects.

So I did this for multiple IOT implementations and my web implementation and soon backend as well.

This also gave me the ability to easily switch between completely different projects.
git checkout mqtt and instantly my mqtt project was setup and ready to work on. And if I felt to write some javascript for web I just did git checkout web and doing this without switching my folder or project structure was pretty amazing in my opinion.

conclusion

Not sure if this is abusing branches but it improved my speed in prototyping projects on multiple platforms and systems.

Pretty neat :3


My Constant State of Chaos

Breaking the Constant State of Chaos

NOTE: This blog post is a non-tech related and its just a general view of everything going on and each one of the activities deserve a blog post on its own but due to not having enough time those will come later.

Bad eating habits, LACK OF SLEEP, unfinished side projects, business ideas that I never start, education, hobbies, deteriorating health, social events and of course working. I juggle all of these things on a daily basis and for the last 21 years, my life has been in a constant state of chaos. As time goes by this only gets worse because I’m someone who wants to do EVERYTHING and until now I’ve been able to do it. But lately the stress has been getting to me, so here goes… my attempt at “getting my shit together“ to become a better Software Engineer and finish my projects, both personal and at work.

The Problem

This constant state of chaos exists in my life because I’m very bad at following my own planning. I can develop a perfect routine for a lifestyle that will help me achieve all that I would like to, but for the life of me I can’t follow it. My days are filled with variables like random social invitations, new articles that I end up reading for hours, new frameworks that I want to test out and I always justify ditching my planning, saying it’s ok, “its for educational purposes“ or “this will help me in x way“ and this ladies and gents is the chaos I live in.

Now some may argue that this is the life of a developer or engineer but is it really? are we doomed to live in this chaos forever, is there maybe a balance we can find?

The Experiment

So I’ve decided I’m going to do a 4 month experiment on a lifestyle/routine change, this experiment consist of selecting a few activities and sticking with these for 4 months straight so I can see if I get everything on track and develop a healthy routine for myself. Even though I want to do everything and I do mean EVERYTHING I’m going to have to make a few choices to stick with. First off I’m going to make a list of all the things I would like to do and I’m currently doing, these are:

  1. School work
  2. Work
  3. Working out
  4. Eating Healthy
  5. Social Events
  6. Playing Guitar
  7. Side Projects (Portfolio)
  8. Learning a specific programming language and/or framework (JavaScript, Vue.js)
  9. Starting a Business (ShockTheWolf & Foxengineer Collaboration)
  10. Discreet Mathematics
  11. Reading

Now I realize some of these are VERY big projects on its own, but that’s the idea. Pick a couple of those activities finish them and continue to the next one if we have time over. Now some of these are not choices at all and are musts but this is the selection process I’m going to use and it will be made up of:

  1. Goals within said choice
  2. Time I have for said choice
  3. Priority of said choice

I’m not going to delve into how all of these fit into said criteria’s but the choices I’ve made so far are based on the those criteria’s.

  • Software Engineer Education
  • Working out
  • Eating Healthy
  • Learning a specific programming language and/or framework (JavaScript, Vue.js)

These are in my opinion the most balanced options for me, this “lifestyle” would consist of self improvement in education, healthier living, progressing as a developer and a hobby that act as a distraction and relaxation time. It may seem like these are very few choices right now but that’s on purpose I want to start out slowly, again I KNOW I suck at following plans, so if I can manage to do only a bit of it and turn my bad habits into good ones then I would have achieved my goals and basically gotten my shit together. Based on those result I can again analyze and breakdown my current routine and lifestyle and adjust accordingly to either add or remove more activities to my routine.

Il probably post back each month with the results for each activity so I can track my progress. So lets hope for the best! See you then.


Shocking

Let’s see if I can write something about my side project called shock the wolf

Backstory - October 2015

Me and a friend had the brilliant idea of incorporating shock collars and games together.
The end result we wanted was for example when you play a 1vs1 in League of legends but every time you get hit you will be shocked and the closer you are to death the higher the shock.
And in the end we wanted to be able to build this into every game we played.

So we went to https://aliexpress.com found the cheapest shock collar with remote and bought it.
I think we paid around 16 euro for it so cheap enough to play around with electronics (we didn’t have any experience with electronics at all).
Skip forward 3/4 weeks and our collar arrived. We played around with it for a bit testing out the different functions and channels and then we broke open the remote.
shock remote
That was the moment we came to the conclusion we have no plan what to do and how electronics work. So like every smart person would we grabbed a raspberry pi put one of the gpio pins on HIGH and establish a ground with another pin. and just start poking on the circuit see if we could get any response.
AND OMG WE GOT A RESPONSE
So we figured out how to control the remote by using electrical pulses. Still no clue how electronics work we decided to solder on some wires on the buttons and plug them into the raspberry pi.
(Second problem we had no experience with soldering and the only thing I was able to find in the shed was a big solder gun)
remote connected to pi

I quickly wrote a web api with FLASK to control the GPIO pins and my friend made a quick program that recorded the screen and if we saw a damage effect it would notify our web api to send a shock.

EUREKA our project worked

So in less than a day we finished our prototype of the project and got some awesome and working results.
But it broke the next day cause me with my fried brain at 3am fried the circuit by plugging in the gpio extender the wrong way.
And we got busy with school and other stuff so we dropped the project.

MOTIVATION - February 2017

During the period in between I learned how to write c and c++ and work with arduino’s and solder decently
So after keeping the project on the downlow sometimes looking at it but thinking sending electical pulses into a remote can’t be future proof. I came with an idea RADIO SIGNALS it was during the time I was very much interested in defcon pressentations and saw some stuff from the wireless village about replaying rf signals and using a rtl-sdr (software defined radio) to decode signals into binary values. But I had no clue how to start or how to even do this. So as usual I went to my favorite website https://aliexpress.com and ordered.

  • A new shock collar with remote
  • Some rf receivers and transmitters 434MHZ
  • a 7 euro dvb-t stick (sdr)

Skip 3 weeks forward.
I did some more research on the subject and after going through some google pages I stumbled on this piece of art - https://gist.github.com/CrosseyeJack/8397361 It was article with almost the exact same things I wanted to do. But being the good person the writer of he article was he never gave any code and never fully enclosed his findings but it got me motivated and dedicated to make this project work.

Booted my debian linux and installed.
http://gnuradio.org/
Was scared and overwhelmed by the amount of stuff gnu radio gave me and the weird way of setting up a protocol. But after using my trusty friend google I got my receiver working and saw beautiful pulses streaming in.
And was able to decode them to logical one’s and zero’s and cut them down into pieces of logical data.
It was basically structured like this
mode, channel, id, value, checksum - 00000000 00000000 00000000 00000000 00000000
and every part was 8bits.
So for example you could say that a shock command could have been.
0000010 00000011 00000010 00001000 11111111
As for the checksum it’s a pretty simple check and it’s the same one as described in the article I mentioned before. but since I am not receiving anything to check if the command was successful I just ignored the checksum part and hard coded it into my program.

After writing down all the commands I wrote a quick sketch in the arduino ide.
To send the binary through the rf transmitter and THE COLLAR BUZZED I was ecstatic and literally jumped off my chair. After I calmed down I wrote some more tests and got all the different commands working.

It works but how am I going to controll it ?

This was the question I kept asking myself for about 3 minutes before googling how to do arduino stuff with WiFi and there it was the beautiful ESP-12 chip. Bloody cheap and plenty of devboards available to keep me from burning my hands with a soldering iron. So I went to aliexpress again and ordered a node-mcu and a wittycloud dev board. about 2,50 euro a piece.


WIP STILL WRITING CALM YOURSELF