Extract translations from your Aurelia app

Posted on 2019-08-03 in Aurelia • Tagged with JavaScript, TypeScript, Aurelia, i18N

If you use Aurelia with the i18n plugin, you will have to maintain JSON files that will map a translation key to an actual translation. Manually editing the file to add/remove keys can be tedious.

Luckily, keys can be extracted automatically thanks to i18next-scanner. It can extract translation keys …


Continue reading

CSS tips

Posted on 2019-03-10 in Trucs et astuces • Tagged with CSS

Apply style to IE11 only

Put the style in this media query:

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    // Put CSS here
}

PyCharm tips

Posted on 2019-03-10 in Trucs et astuces • Tagged with Python, IDE, PyCharm

View print output immediately

Add PYTHONUNBUFFERED=1 in run config or .env (only use .env if you use the plugin). This is meant to immediately view the output …


Continue reading

ZSH tips

Posted on 2018-10-09 in Trucs et astuces • Tagged with ZSH, Shell, Linux

Sommaire

ZBell

Useful to have a notification when a long command completes.

To enable it, add zbell to your plugins array if you are using oh-my-zsh or source the definition file.

To configure:

  • The minimum time commands must take for the notification to happen, use: ZBELL_DURATION. For instance ZBELL_DURATION …

Continue reading

Bash tricks

Posted on 2018-10-03 in Trucs et astuces • Tagged with Bash, Shell, Linux

Sommaire

Scripts

Use this at the top of all your Bash scripts to avoid problems:

# Exit on error.
set -e
# Don't allow undefined variable.
set -u
# Make pipeline fail if any command in it fail.
set -o pipefail

Heroku tips

Posted on 2018-10-03 in Trucs et astuces • Tagged with devops, Heroku

Use an editor

By default there is no editor on Heroku. To get one, you can use the heroku-nano plugin like this (or by installing as a plugin):

mkdir bin
cd bin
curl https://github.com/Ehryk/heroku-nano/raw/master/heroku-nano-2.5.1/nano.tar.gz --location --silent > nano.tar …

Continue reading

Python tricks

Posted on 2018-10-03 in Trucs et astuces • Tagged with Python

Inspect TLS certificates with requests

Use the snippet below to capture and inspect the certificates of a distant site and its chain with requests.

import requests

HTTPResponse = requests.packages.urllib3.response.HTTPResponse
orig_HTTPResponse__init__ = HTTPResponse.__init__
def new_HTTPResponse__init__(self, *args, **kwargs):
    orig_HTTPResponse__init__(self, *args, **kwargs …

Continue reading

Deploy to your test server with git hooks

Posted on 2018-09-09 in Programmation • Tagged with git, devops

You probably already wanted to have your own test environment to allow others in the company to tests what you did. Perhaps you have a common one, but as your team is growing, it is probable that the common environment is a bottleneck and you wish each developer could have …


Continue reading

Use dnsmasq with NetworkManager

Posted on 2018-09-08 in Trucs et astuces • Tagged with linux

This will, for instance, allow you to redirect all matching domains to a certain server: dnsmasq will intercept the DNS query and return the ip you specified.

To do this, edit NetworkManager configuration in /etc/NetworkManager/NetworkManager.conf and add in the main section dns=dnsmasq:

[main]
dns=dnsmasq

You …


Continue reading

VSCode tips

Posted on 2018-09-02 in Trucs et astuces • Tagged with VSCode

Sommaire

Python

venv

To use a venv with VSCode, add in the folder settings:

{
    "python.pythonPath": "~/.virtualenvs/bureauxlocaux--Uxk5jFn/bin/python",
    "python.unitTest.pyTestEnabled": true
}