Not today...

comments

Project

Listing directory with wsgi

Recently I ran into an issue with my blog and pelican (the blogging engine I use). For some reasons (which I explain here) I had to develop a small wsgi app which act like the python SimpleHTTPServer. I tried a lot of things but they never worked as I wanted them to. So, I decided to do this by myself. Specifications Here are the features I wanted: Define a directory as the root (/) directory from which all the files will be served. Read More...

Tagged dev , python

comments

Tuto

Patch dependency

When developing on a project it is possible that a dependency can have an issue. First you want to be able to debug it (pdb, ipdb), then modify it if you find a bug. To do that there is a naive way in python, which consist in editing directly the sources of the module. But there is a cleaner way based on pip. The -e option allows you to pass a path (git, http, file) for a given module and link it to your environment. Read More...

Tagged dev , python

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

OS

Debian install 2

After many days of configuration, I finally complete the installation of my perfect “workstation” ;). source.list I have to directory for this, first the preferences, then the sources.list. Just run an aptitude update, and you will some missing gpg keys, now run apt-key adv --recv-keys --keyserver keyserver.ubuntu.com <key_number> To have your keys installed. sudo A sudo file is important in order to correctly manage a computer, a simple aptitude install sudo will give you the tool. Read More...

Tagged bash , adminsys

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

Project

Small docker project

I really like docker (even if I will look at [systemd-nspawn](http://www.freedesktop.org/software/systemd/man/ systemd-nspawn.html)), and also gulp. So I decided to create a small tool for serving a directory with a livereload. The repo is available here What I have learned Docker, especially with boot2docker (I am on MacOSX shame on me), is not really flexible: no evaluation for environment variables you can not store a variable through multiple run, you will need to do a oneliner e. Read More...

Tagged admin , bash , 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

Snippet

Test promises with jasmine

Jasmine is a good testing framework, which I really like, it is really powerfull and has just the amount of features to perform a huge variety of tests. At some point I had to tests promises, and more generally testing that some part of a function is not called (you will have to adapt the snippet but the idea is here). It is pretty simple, but not well known (I checked some stackoverflow threads before finding this). Read More...

Tagged jasmine , tests

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