By hackjutsu
Disclaimer: This cheatsheet is summarized from personal experience and other online tutorials. It should not be considered as an official advice.
:help keyword # open help for keyword
:o file # open file| from django.conf import settings | |
| from importlib import import_module | |
| from redis import Redis | |
| import base64 | |
| import json | |
| SESSION_KEY = 'examplehashsessionid' | |
| def get_value_from_redis(key=SESSION_KEY): | |
| """ Get value from the DB using redis cli """ |
| import re | |
| import json | |
| from django.urls import URLPattern, URLResolver, reverse | |
| from django.utils import translation | |
| from django.core.exceptions import ViewDoesNotExist | |
| from django.core.management import color | |
| from django.contrib.admindocs.views import simplify_regex | |
| from kavehome_pt import settings |
| #! /bin/sh | |
| # Produce a squash-commit patch from a branch of changes | |
| # Usage example: sh git-squash.sh master <branch_to_squash> | |
| MASTER=$1 | |
| PATCHBRANCH=$2 | |
| SQUASHBRANCH="$PATCHBRANCH-squash" | |
| git checkout -b "$SQUASHBRANCH" $MASTER && | |
| git merge --squash "$PATCHBRANCH" && | |
| git commit -a -m "Squash commit" && |
| #!/bin/bash | |
| # | |
| # Usage: | |
| # | |
| # Indicate the name of the output file with the flag: -f | |
| # Indicate the list of Pull Requests with the flat: -p. The format is a quoted string sepparated by spaces. | |
| # | |
| while getopts p:f: option | |
| do |
| # coding=utf-8 | |
| from erppeek import Client | |
| import click | |
| def uninstall_module_get_queries(client, module_id): | |
| queries = [] | |
| imd_o = client.model('ir.model.data') | |
| module_o = client.model('ir.module.module') |
Disclaimer: This cheatsheet is summarized from personal experience and other online tutorials. It should not be considered as an official advice.
:help keyword # open help for keyword
:o file # open file| # -*- coding: utf-8 -*- | |
| import click | |
| import csv | |
| import re | |
| import os | |
| import subprocess | |
| from xml.etree.ElementTree import Element, SubElement | |
| from xml.etree import ElementTree as ET | |
| from xml.dom import minidom | |
| import sys |
| from datetime import datetime | |
| import asyncore | |
| from smtpd import SMTPServer | |
| class EmlServer(SMTPServer): | |
| no = 0 | |
| def process_message(self, peer, mailfrom, rcpttos, data): | |
| filename = '%s-%d.eml' % (datetime.now().strftime('%Y%m%d%H%M%S'), | |
| self.no) | |
| f = open(filename, 'w') |
| #!/bin/bash | |
| # This script should be placed in the /tools folder of the ERP base directory. | |
| # And be executed from the /erp directory this way: ./tools/merge_trans.sh -m <module_name> | |
| module=$2 | |
| if [[ -z $1 ]] || [[ "$1" != "-m" ]] || [[ "$1" = "-h" ]] || [[ "$1" = "--help" ]] || [[ -z $2 ]]; then | |
| echo "Indicate the module that has conflicts this way: -m <module-name>." | |
| else | |
| line=1 | |
| module_dir=`cd .. | locate -r /$module$ | grep "erp/addons" | sed -n "$line"p` |