Not today...

Filed under Tuto...

comments

Tuto

Systemd-nspawn

I am a huge fan of docker for my dev environments, it helps me keeping things clear and understanding what are the ressources needed for a project. A few month ago a friend told me that there already is a similar feature on Linux, and this feature is systemd-nspawn. Creating your first container So like docker I wanted to first start a container. Nspawn has no environment so everything has to be done “by hand”. Read More...

Tagged systemd , admin

comments

tuto

Pytest Fixture

I am a huge fan of python (one of the best language in my toolbox). And when it comes to tests, pytest is THE library to use. I also use Flask a lot, so today I will show you some of my snippets. First one the app fixture: @pytest.fixture(autouse=True) def app(): """Load flask in testing mode""" app_test = myapp app_test.config['TESTING'] = True app_test.json_encoder = my_encoder return app_test.test_client() This create an app fixture which will be used to test the application, it returns a test client to interact with my Flask application. Read More...

Tagged python , dev

comments

Tuto

ssh, rsync and fswatch

Sometimes I just can’t work on a local environment (particular architecture, particular services, local configuration too complex, etc…). So, I have to synchronize my local directory with a remote one and test the web interface on my local machine. ssh First, ssh! For this I need a ssh connection to the remote server, here I use a particular ssh key. ssh -i ~/.ssh/my_ssh.key mylogin@192.168.0.1 # urls also work ssh -i ~/. Read More...

Tagged admin , bash

comments

tuto

Curl for REST

It has been a long time since the last post. But today, I will just show two tools I use for debugging my REST APIs. First one is the well known curl and the second one is jq. One important feature of curl is its hability to load external files for datas with @ before file name: curl -X POST -H "Content-Type: application/json" -d @filepath Then you can remove the progress bar by adding -s in the options Read More...

Tagged admin , cli , bash

comments

Tuto

Angular $parse

Hey there, I have started to be tired of weak example of angular power, so I will go deeper on angular services and directives and wrote some articles about it. The service $parse is the one who runs on the html to bind data with your javascript. It provides a lot of useful features which can be really interesting especially with directive manipulation. So, we will illustrate with some examples: Read More...

Tagged javascript , angular , web

comments

Tuto

Bash Script

Writting a bash script is kind of a complicated task, there is a strict syntax, multiple external tools, and some tricks which depends on the version and in some cases on the distribution itself (for example, grep is not the same either you are on BSD or Debian). In this article I will talk about four code habits which can improve the maintainability of your shell scripts Double quotes Everyone who already used a bash script will tell you to mark every variable reading with double quotes: Read More...

Tagged bash

comments

Tuto

Outside Angular

There are some cases when angular is accessible but we just want to access a specific service without bootstraping an entire application. For example, in some tests I can load some fixtures with the $http service, or use $compile for a simple template. It is pretty simple to do that, but it is not clearly explained in the angular documentation. So here is an example: // The module ng must be loaded angular. Read More...

Tagged javascript , angular , web