Bash tricks
Posted on 2018-10-03 in Trucs et astuces • Tagged with Bash, Shell, Linux
Posted on 2018-10-03 in Trucs et astuces • Tagged with Bash, Shell, Linux
Posted on 2018-10-03 in Trucs et astuces • Tagged with devops, Heroku
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 …
Posted on 2018-10-03 in Trucs et astuces • Tagged with Python
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 …
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 …
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 …
Posted on 2018-09-02 in Trucs et astuces • Tagged with VSCode
Posted on 2018-07-16 in Trucs et astuces • Tagged with Rollbar, Python, Ansible
I recently had to integrate Rollbar (a service to track errors) with a JS application. One nice thing about Rollbar is that if you provide it with source maps, it will point to you where the error is in the original unminified code.
Since the application is deployed with Ansible …
Posted on 2018-06-02 in Trucs et astuces • Tagged with Python
You can use signals and a context manager to acheive this. The idea is to register a function that will raise an exeption when the alarm signal is received and schedule the alarm signal for the timeout.
import signal from contextlib import contextmanager @contextmanager def timeout(time): # Register a function …
Posted on 2018-05-21 in Trucs et astuces • Tagged with Python, Web, Django
Posted on 2018-03-07 in Trucs et astuces • Tagged with JavaScript
Rely on String.prototype.normalize().
const str = "Crème Brulée" str.normalize('NFD').replace(/[\u0300-\u036f]/g, "") > 'Creme Brulee'