Supprimer la ligne encoding de fichiers python

Posted on 2015-07-22 in Trucs et astuces • Tagged with python, Bash/Shell

Lors du passage à python 3 sur un projet, j'ai décidé de supprimer les lignes qui donnent l'encodage du fichier. En effet, ils étaient tous en UTF-8 et c'est l'encodage par défaut sous python 3.

J'ai écrit ce petit script pour automatiser tout ça :

for file in $(find chsdi/ -name …

Continue reading

CORS and HTTP authentication

Posted on 2015-06-27 in Auto-hébergement • Tagged with nginx, apache, webdav, owncloud

Before doing a request (POST, GET, PUT, …) on another domain with Javascript, web browsers will perform an OPTIONS request to verify that the request is likely to be accepted by the server. They mostly check for CORS headers.

This doesn't cause any troubles if …


Continue reading

Use udev to setfacl when mounting a usb drive

Posted on 2015-05-31 in Trucs et astuces

Write the line below (and adapt it) in /etc/udev/rules.d/:

SUBSYSTEMS=="block",ACTION=="add",KERNEL=="sd?1",RUN+="/usr/bin/setfacl -m    u:apache:r-x /run/media/jenselme"

Attention: if the path of the command is not absolute, udev will search of it in /usr/lib/udev.


Use docker to deploy a Glassfish application

Posted on 2015-05-24 in Programmation • Tagged with Java, Glassfish, Docker

Recently I had to deploy an application on Glassfish. Since Glassfish is not packaged on the distribution I have on my server (Fedora Server) and I wanted to avoid to pollute my system I decided to use Docker.

In order to deploy my application correctly, I based my Dockerfile on …


Continue reading

Docker tips

Posted on 2015-05-24 in Trucs et astuces • Tagged with Docker

For my tips about docker compose, go here.

Create an image

docker build -t <name> .

Save and import

docker save <image> > file
docker load < <image>

Run

docker run --name …

Continue reading

AngularJS tips

Posted on 2015-04-26 in Programmation • Tagged with JavaScript, AngularJS

This page lists all the angularjs tips I have collected.

Disable HTTP request caching

This is mostly useful on Internet Explorer: every HTTP requests made with the $http service …


Continue reading

Git tips

Posted on 2015-04-26 in Programmation • Tagged with git

This pages provides all gitips I have collected.

Rebase

Split commit

After git rebase -i, run git reset HEAD~ to split …


Continue reading

Connect to a running docker container

Posted on 2015-03-25 in Trucs et astuces • Tagged with Docker

If you are running docker 1.3 or above, you should use: docker exec -it CONTAINER COMMAND to run COMMAND within the container. You can easily create a function to ease the thing and run bash by default:

dk-enter() {
    docker exec -it "$1" "${2:-/bin/bash}"
}

Otherwies, you can easily …


Continue reading

VirtualBox

Posted on 2015-03-01 in Trucs et astuces • Tagged with VirtualBox, Virtualisation

Transform img disk (qemu) to vdi (Virtual Box)

You need to convert img in raw with qemu-img …


Continue reading

Fusionner deux dépôts git

Posted on 2015-01-17 in Trucs et astuces • Tagged with git, Linux

Récemment, j'ai eu besoin de fusionner deux dépôts en un seul. Ça se fait plutôt bien. Voilà la procédure :

# On clone les dépots
git clone projet1
git clone projet2
cd projet1

# On ajoute le projet2 comme source dans le projet1
git remote add projet2 ../projet2
git fetch projet2

# On liste …

Continue reading