Skip to content

Instantly share code, notes, and snippets.

View legalsylvain's full-sized avatar

Sylvain LE GAL legalsylvain

View GitHub Profile
@legalsylvain
legalsylvain / Linux_to_know.md
Last active September 16, 2015 06:51
Linux

Gestion des fichiers

du -hs ./unfolder/

Taille d'un dossier. (avec sous dossier)

  • du : Disk Usage
  • -h : "human"
  • -s : "Summarize"

sed -i 's/ugly/beautiful/g' ./path_to_file.ext

remplace une chaine de caractère par une autre

Taille d'une base de données

SELECT pg_size_pretty(pg_relation_size('DB_NAME'));

Taille des tables (50 plus grosses)

select schema,name, pg_size_pretty(CASE WHEN is_index THEN 0 ELSE s END) AS size, pg_size_pretty(CASE WHEN is_index THEN s ELSE st - s END) AS index, CASE WHEN st = 0 THEN 0 WHEN is_index THEN 100 ELSE 100 - ((s*100) / st) END || '%' as ratio, pg_size_pretty(st) as total FROM (SELECT *,st = s AS is_index FROM (SELECT nspname as schema, relname as name, pg_relation_size(nspname || '.' || relname) as s, pg_total_relation_size(nspname || '.' || relname) as st FROM pg_class JOIN pg_namespace ON (relnamespace = pg_namespace.oid)) AS p) AS pp ORDER BY st DESC LIMIT 50;

Recuperation de la table associe à un pg_toast_xxx;

select xxx::regclass;

Squatch

git rebase -i NOM_BRANCH~[X]

pick C1 s C2 pick C3 ... pick CX

-> merge C2 et C1

For a many2many field, a list of tuples is expected. Here is the list of tuple that are accepted, with the corresponding semantics
(0, 0, { values }) link to a new record that needs to be created with the given values dictionary
(1, ID, { values }) update the linked record with id = ID (write values on it)
(2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)
# Multi Action
<act_window id="base.action_partner_mass_mail"
name="[TITLE]"
src_model="my.src.model"
res_model="my.target.model.wizard"
view_mode="form"
multi="True"
target="new"
key2="client_action_multi"
server {
listen 443;
server_name ERP.MY_DOMAIN.TLD;
# Time Out
proxy_connect_timeout 60000;
proxy_send_timeout 60000;
proxy_read_timeout 60000;
send_timeout 60000;
keepalive_timeout 60000;
# Firefox Addons
## https://addons.mozilla.org/fr/firefox/addon/ublock-origin/
## https://addons.mozilla.org/fr/firefox/addon/odoo-debug/
## https://addons.mozilla.org/fr/firefox/addon/disconnect/
## https://addons.mozilla.org/en-US/firefox/addon/nimbus-screenshot/
# Installation of sublim Text
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo add-apt-repository "deb https://download.sublimetext.com/ apt/stable/"
### Odoo Commands
run_odoo_12 () {
cmd="sudo su odoo12 -c './env/bin/python3 ./src/odoo/odoo-bin -c ./odoo.cfg $@'";
eval "$cmd";
}
run_odoo_8 () {
cmd="sudo su odoo8 -c './env/bin/python2 ./src/odoo/openerp-server -c ./odoo.cfg $@'";
eval "$cmd";
}
<record id="issuer_1" model="meal.voucher.issuer">
<field name="name">Chèque Déjeuner</field>
<field name="commercial_name">Up Déjeuner</field>
</record>
<record id="issuer_2" model="meal.voucher.issuer">
<field name="name">Edenred France</field>
<field name="commercial_name">Ticket Restaurant</field>
</record>