Archive

Archive for August, 2018

100% Stateless with JWT (JSON Web Token) by Hubert Sablonnière

August 31, 2018 Leave a comment

In our modern REST architectures, the session cookies of old are getting stale and crusty. It’s time to unbox JSON Web Tokens : a new approach, simpler, 100% stateless and easily scalable.

No more server side session storage. No more session replication across the cluster. Best of all, navigating multiple layers of APIs with only a single connection is much easier.

In this talk, you will discover the inner workings of JWTs. You will see how to handle a client session properly between a browser and a server. We will explore other usages and wrap up with pros and cons.

Hubert Sablonnière
I’m a curious and passionnate Web developer. I’m specialized in HTML, CSS and JavaScript but I also use server side technologies like NodeJS, PHP, Java, Neo4j, Docker…

With OpenDevise I help clients to move their trainings and conference talks to the next level.

My motivation : “To push the technology far enough to find new ways to improve user’s experiences.”

[DUK-7522]

Categories: Interesting Tags:

The Fullstack Tutorial for GraphQL

August 30, 2018 Leave a comment

The free and open-source tutorial to learn all around GraphQL to go from zero to production.

https://www.howtographql.com

Categories: Interesting

FOSS Software Alternative to Popular Proprietary Software

August 29, 2018 Leave a comment
Categories: Interesting

Multiple git user profiles

August 28, 2018 Leave a comment

Problem:
How to have two git user profiles on one machine?

Solution:
From stackoverflow.

Global config ~/.gitconfig

[user]
name = John Doe
email = john@doe.tld

[includeIf “gitdir:~/work/”]
path = ~/work/.gitconfig

Work specific config ~/work/.gitconfig

[user]
email = john.doe@company.tld
name = Nickname # If you do not want to use John Doe

Source:
https://stackoverflow.com/questions/4220416/can-i-specify-multiple-users-for-myself-in-gitconfig

Categories: git

Introduction to Digital Certificates.

August 27, 2018 Leave a comment

This tutorial starts with a review of Symmetric and Asymmetric (PKI) Encryption. It discusses self signed certificates and how an SSL certificate is used in a Client-Server web communication session.

Categories: Interesting Tags: ,

How to write secure code in Python

August 26, 2018 Leave a comment

Since the beginning of the digital age, information has become one of the most valuable resources in the world. Personal information, bank data, logins and passwords – all of this, on one hand, makes life a lot easier in many aspects, and on the other, can be used by attackers to commit actions which will have negative consequences for the owner of this information.

Of course, in order to get hold of this information, you first need to find the vulnerabilities in the software that will allow you to steal important information by interfering with the correct execution of the program. In this article, we’ll look at vulnerabilities that the Python developer have to avoid when creating the software, and also give recommendations for writing secure code.

https://py.checkio.org/blog/how-to-write-secure-code-in-python/

Categories: python

Fantasy Name Generator

August 23, 2018 Leave a comment

To generate some Klingon names instead of using John and Jane Doe.

http://www.fantasynamegenerators.com/star-trek-klingon-names.php

Categories: funny

docker: Error response from daemon…

August 22, 2018 Leave a comment

Problem:
I was getting this error.

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused “exec: \”telnet\”: executable file not found in $PATH”: unknown.

$ docker run --name greeter -d --expose 5000 alpine /bin/sh -c "echo Welcome stranger | nc -lp 5000"
51b6a0b73dc1cbc9b39757dff20ada1f5638c1ec781625d9e2fc6c9cced01639
$ docker exec greeter ifconfig
eth0      Link encap:Ethernet  HWaddr 02:42:AC:11:00:02
          inet addr:172.17.0.2  Bcast:172.17.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:758 (758.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
$ docker run alpine telnet 172.17.0.2 5000
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"telnet\": executable file not found in $PATH": unknown.
ERRO[0000] error waiting for container: context canceled
$ docker run -it alpine /bin/sh
/ # telnet 172.17.0.2 5000
/bin/sh: telnet: not found

Solution:
This error means that whatever I am trying to run does not exist. So my options are to install telnet in the container or use a different command like `nc`.

Categories: bash Tags:

port forwarding

August 17, 2018 Leave a comment

Problem:

You want to access a site with a particular IP. Eg google maps only allows a set of IPs to access. So running code from a vagrant box then accessing from the host is not so straight forward.

Solution:
Went with using ssh

$ ssh -nNT -L 3000:localhost:3000 vagrant@127.0.0.1 -p 2222

So on the host I can access a service running on a vagrant box (192.168.33.10:3000) via localhost:3000

Categories: bash

complete:13: command not found: compdef

August 6, 2018 Leave a comment

Problem:
You get this error `complete:13: command not found: compdef` for a customised zsh profile. I am trying to add kubectl completion for zsh.

Solution:
Install the zsh packages below, Save and exit.

$ autoload -Uz compinstall && compinstall

Source:
https://unix.stackexchange.com/questions/339954/zsh-command-not-found-compinstall-compinit-compdef

Categories: zsh Tags: