Skip to content

Instantly share code, notes, and snippets.


Antoine Lorence alorence

View GitHub Profile
alorence /
Last active Oct 12, 2021
Very simple script to dump a named Odoo database into restorable zip file (with filestore)
import base64
import os.path
import sys
from datetime import datetime
from xmlrpc.client import ServerProxy
full_host = os.getenv("ODOO_HOST", "http://localhost:8069")
master_pwd = os.getenv("ODOO_MASTER_PASSWORD")
if master_pwd is None:
alorence /
Last active Apr 21, 2020
Curated list of articles to understand complex topics

The Definitive Guide to Python import Statements | Chris Yeh

The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) – Joel on Software

Python and Django Logging in Plain English

An A-Z of useful Python tricks

alorence /
Created Aug 30, 2018
An example of namespace management and simple Xpath search with ElementTree
# -*- coding: utf-8 -*-
from __future__ import print_function
import xml.etree.ElementTree as ET
xdoc = """
<ns:response xmlns:ns="">
<inner>Some text here</inner>
alorence / bootstrap4-grid.html
Created Jan 2, 2018
Visualize various responsive predefined sizes in Bootstrap 4
View bootstrap4-grid.html
<!doctype html>
<html lang="en">
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="" integrity="sha384-Zug+QiDoJOrZ5t4lssLdxGhVrurbmBWopoEl+M6BdEfwnCJZtKxi1KgxUyJq13dy" crossorigin="anonymous">
alorence / home_end_rebind.zsh
Last active May 21, 2017
Define custom binding for HOME and END keys, which are not well handled under some Windows SSH clients (mRemoteNG, PuTTY, MobaXTerm, etc.)
View home_end_rebind.zsh
# Correct the behavior for HOME and END keys
bindkey '^[[1~' beginning-of-line
bindkey '^[[4~' end-of-line
alorence /
Created May 17, 2016
Default django test module to use when pytest is the preferred test framework
# If your Django project uses pytest instead of the default django test framework, simply put this file in an application.
# It will be run when 'python test' is run and inform user that the project must be tested using pytest.
from django.test import TestCase
class UsePyTest(TestCase):
def test_use_pytest(self):
alorence /
Created Jul 29, 2015
CheatSheet for some python synxtax
s = 'abcdefghij'
stmts = [
alorence / CMakeLists.txt
Last active Sep 6, 2020
Two CMake macros returning the current date (format yyyy-mm-dd) and the current time (hh:mm:ss). These are completely useless since CMake 3.0 and the introduction of `string(TIMESTAMP)` command.
View CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
# Return the date (yyyy-mm-dd)
execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT})
string(REGEX REPLACE "(..)/(..)/(....).*" "\\3-\\2-\\1" ${RESULT} ${${RESULT}})
execute_process(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
alorence / gist:8685116
Created Jan 29, 2014
Buggy Graphiti property sheet (Mac OS only)
View gist:8685116
import org.eclipse.graphiti.ui.platform.GFPropertySection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
public class TestPropertySection extends GFPropertySection implements
ITabbedPropertyConstants {