MQTT Client for OSX
For those working with OSX, I suggest you to use the most powerful MQTT client I’ve found: MQTTfx. This soft is complete. You will find all the basic features (like unsecured connection, already available on most light tools) and some very useful:
- User/password authentication
- SSL/TLS
- Proxy settings
You have a large choice of certificates, which covers a lot of scenarios and platforms (SAP IoT 4.0 Platform included)
Fingerprint Check to verify HTTPS certificates
Sometimes, it can be useful to check if you are sending data or connected to the right website (for security purposes). In my case, when I’m connecting Arduino boards or something like this with network I’m not the owner, I’m using the fingerprint check.
Let’s see how it works.
First, you need to retrieve the fingerprint for the target website/API. For this, go to the website and click on the little “lock” icon in the address bar and click on the Certificate section.
Now, scroll down while you find the Fingerprints section and copy these two values (see below the example with Github).
The last step is to check when you establish the connection, if the fingerprint is the same or not. Below, an example in Arduino
// Check HTTPS
WiFiClientSecure client;
Serial.print("Connecting to ");
Serial.println(host);
if (!client.connect(host, httpsPort)) {
Serial.println("Connection failed");
return;
}
if (client.verify(fingerprint, host)) {
Serial.println("Certificate matches");
} else {
Serial.println("Certificate doesn't match");
}
// The rest of your code...
Consola
Logs are important when you code – If you pass your day, switching between terminal windows, it’s time to get them sexy! For this, I found Consola and I fall in love with this elegant consoler logger.
npm install consola --save
And now in your code, you can log info like this:
const consola = require('consola')
// See types section for all available types
consola.start('Starting build');
consola.success('Built!');
consola.info('Reporter: Some info');
consola.error(new Error('Foo'));
Give a try here: https://github.com/nuxt/consola
Full width embedded Youtube video
If you want to embed your Youtube video on your blog (WordPress or other), it’s possible with some custom CSS.
First go to the video link you want to embed and click on Share > Embed and get the whole iframe tag.
For example: <iframe width="560" height="349" src="http://www.youtube.com/embed/<YOUR_VIDEO_ID>" frameborder="0"></iframe>
Now, wrap the iframe tag inside a div and add the css.
<div class="youtubeVideoContainer">
// the iframe tag here
</div>
.youtubeVideoContainer {
position: relative;
padding-bottom: 56.25%;
padding-top: 25px;
height: 0;
}
.youtubeVideoContainer iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
That’s it. Your video will use the full width of your post.