Not today...

Filed under Snippet...

comments

snippet

Docker Nspawn

Don’t want to use Docker? Still want to start containers for tests or whatever? Don’t want to install yet another software to perform this? Want to understand a bit of how all those things work? Great! I will show you how to boot a container from the internet only through systemd-nspawn Thanks to the CoreOS team (love those guys) a new hub for storing container now exists: quay. The other good news is the ACI, the container image format defined in the App Container (appc) spec. Read More...

comments

Snippet

Curl utils

Here are some options and command I use with curl when dealing with stuff I have to develop. curl -si <ip> # -s is the silent flag, it removes the progress # -i displays the headers curl -X POST -H "Content-Type: application/json" -u "admin:admin" -d '{}' <ip> # -X set up the http method (here POST) # -H set up an header, format is: "header_name: value" # -u support for Basic Auth, format is: "user:password" # -d set up data to send to the server I mostly use those options, the -s is really interesting when you want to grep the content. Read More...

Tagged bash

comments

Snippet Tuto

Gogs + Drone

Jenkins is everywhere now, but I really don’t like it. So I am looking at a replacement from day to day. I discovered Gogs an I though that a CI is also a good use case for the Golang language. And I finally found Drone (which was not really difficult as it is mentionned in a ticket on gogs github). So I decided to make them work together in order to test that. Read More...

Tagged admin

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

Snippet

Pytest command line

I have recently dug into pytest documentation, and moreover into the command line arguments and I finally found a better workflow for running tests while I develop. Here is the command I run when I just made some devs: py.test -xvvvs --tb=line --pdb -x will stop execution on first failue, useful when debugging tests in order of appearance (recommended) -vvv will display current test path (reuasable in py.test), the path will avoid to rerun all the previous tests before going to the one you are currently working on. Read More...

Tagged tests , python , cli

comments

Snippet

Bash Expansion

A small post just to share a useful bashism the Brace Expansion. It is really simple to make it works: for i in {1..50} do echo "Hello World $i" done It will print fifty “Hello World”. Ok it seems cool but not amazing? Ok, now the second feature echo something/{foo,bar} > something/foo something/bar Still not amazed, ok now type this one: cp some_file{,.old} It will copy your file adding a . Read More...

Tagged bash , cli

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

Snippet

HTML5 Boilerplate

Sometimes we only need to have a boilerplate quickly to test it through a browser. We only want to have the basis, and having it working fine. You can find here a good generator for what you want. But sometimes, having a snippet in the bash prompt can be needed. So here is an example: # stop script if something bad happen set -e # unzip need to have a tempfile to extract properly TMPFILE="/tmp/tempfile. Read More...

Tagged bash , web