How to properly manage ssh keys for server access
This article was on the hacker news frontpage. You can find the related discussion here.
Every developer needs access to some servers for example to check the application logs.
Usually, this is done using public-private key encryption where each developer generates their own public-private key pair. The public keys of each developer are added to the authorized_keys file on each server they should have access to.
Painful manual changes So far so good.
Swift as a viable Python alternative?
Recently Swift for Tensorflow has picked up some steam, so I wanted to explore the Swift programming language a bit.
The main advantage over Python for Swift is that Swift is very fast by directly using the LLVM compiler infrastructure. Python itself relies a lot on C to make code run fast, but if you write Python code you can get very slow code if it’s not optimized.
However, the main disadvantage for Swift is that it’s ecosystem when it comes to machine learning and data processing libraries is currently a lot less powerful than Python’s ecosystem.
Bash: Keep Script Running - Restart on Crash
When you are prototyping and developing small scripts that you keep running, it might be annoying that they quit when an error occurs. If you want very basic robustness against these crashes, you can at least use a bash script to automatically restart your script on error.
The tool to use here is called until and makes this a breeze.
Let’s use a dumb example Python script called test.py:
import time while True: print('Looping') time.
Better unit tests in Django using Mommy
Unit testing your models in Django As a good developer, you write unit tests, of course. You will probably even write your tests before implementing your logic in a test-driven approach!
However, when developing complex models which have interactions and foreign keys, writing tests can get messy and complicated.
Say you want to test a model which has many dependencies to other models via foreign keys. To create an instance of your model, you first need to create all the other model instances which your model uses and that can be pretty tiring.
Build Your Own Javascript Game in 5 Minutes
Hello Phaser.io (version 3) Phaser is a JavaScript library which makes it super easy for you to build games. It builds on top of WebGL, but if your browser doesn’t support that, falls back to canvas support. In this quick post, I will show you how to get up and running with your first game in literally 5 minutes (if you take mine as a starter). Note that I use the new version 3 while many tutorials and example games are written in version 2.