Not today...

Filed under dev...

comments

Snippet

Git clone inside a mounted volume with Docker

DISCLAIMER: This is now fixed in git new releases and does not need to be done anymore. I use an old version of alpine in order to have an unpached version of git. I ran into an interesting issue lastly. I wanted to mount a volume inside a container and clone a repo in it. I also wanted to avoid messing with the permissions and pass my user to the container as well. Read More...

Tagged dev

comments

snippet

Makefile

Recently, I had to build some project involving a lot of files. Two choices were possible: use a script to build use a Makefile I ended up with a Makefile, which is the best solution I think. As the script has to generate a bunch of files from “source” files. (I have to confess also, I have been a bit influenced by jessfraz with those tweets: here and here) This project also learned me some tricks which can be reused, here is a little list Read More...

Tagged dev

comments

Snippet

Getting rid of gulp bunch of dependencies

Recently Nodejs environment broke due the removal from npm of a small library (11 SLOC): leftpad. As it hit the world and broke a bunch of projects and CIs, I asked myself if my projects contains so much dependencies that if one break, everything collapse. The problem For developing my frontend I use a tool which I really like: Gulp. The issue there, is that for working with multiple building process involved a lot of glue and third party libraries. Read More...

Tagged dev , javascript

comments

Tuto

Pdbpp

I am a huge fan of ipython and its debugger ipdb (I have also done a patch on it). Then I discovered pdbpp and I found it so great that I no more use ipdb, here is why. More features Sticky mode Pdbpp comes with a lot of additional features which are really convenient. The first and more well known is the sticky mode: This will display the code currently, executed and shows you with an arrow at which exact line you are. Read More...

Tagged dev , python

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

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