Skip to content

Instantly share code, notes, and snippets.

View yelizariev's full-sized avatar
Matthew 22:30

Ivan Yelizariev yelizariev

Matthew 22:30
View GitHub Profile
@yelizariev
yelizariev / nginx_odoo.conf
Last active May 10, 2017 11:51
How to deploy SaaS Demo
server {
listen 80;
#rewrite ^/.*$ https://$host$request_uri? permanent; #Uncomment this line in case you want to use https only
server_name NGINX_SERVER_DOMAIN;
include odoo_params;
location /longpolling {
proxy_pass http://SERVER_HOST:8072;
}
@yelizariev
yelizariev / 1-instruction.rst
Last active April 11, 2018 12:21
Emulate odoo pos BOX

hw_escpos

  • apply patch
  • install hw_escpos on odoo
  • run odoo with -d DB_WITH_HW_ESCPOS --db-filter=DB_WITH_HW_ESCPOS
  • in new terminal run
@yelizariev
yelizariev / current-stats.sh
Last active October 17, 2016 07:58
check and configure postgres
# connect to docker
docker exec -i --user=root -t db-9.5 /bin/bash
# inside docker
psql -U odoo
# inside psql
select datname, count(*) from pg_stat_activity group by datname;
'''
# Installation:
sudo pip install PyGithub
# create token here: https://github.com/settings/tokens (you don't need to set any access checkboxes there)
# Usage
curl -s https://gist.githubusercontent.com/yelizariev/3d5152df5226d03f8bcea08ece939e9a/raw/pull-requests-portfolio.py | python - --token=ABCDE \
"https://github.com/it-projects-llc/access-addons/pull/26" \
cd /path/to/module/
# view source
find . -iname "*.py" -or -iname "*.xml" -or -iname "*.csv" -or -iname "*.yml" -or -iname "*.rst" -or -iname "*.md" | xargs tail -n +1 | less
# view source without docs
find . -iname "*.py" -or -iname "*.xml" -or -iname "*.csv" -or -iname "*.yml" | xargs tail -n +1 | less
@yelizariev
yelizariev / new-api.sh
Last active March 17, 2017 05:37
Helpers for migrating to new odoo api (10.0+). Obsolete. Check for latest version here: https://odoo-development.readthedocs.io/en/latest/migration/index.html
# IMPORTS
# replace osv, orm
find . -type f -name '*.py' | xargs sed -i 's/from openerp.osv import orm$/from odoo import models/g'
find . -type f -name '*.py' | xargs sed -i 's/from openerp.models.orm import Model$/from odoo.models import Model/g'
find . -type f -name '*.py' | xargs sed -i 's/osv.osv_memory/models.TransientModel/g'
find . -type f -name '*.py' | xargs sed -i 's/osv.osv/models.Model/g'
find . -type f -name '*.py' | xargs sed -i 's/osv.except_osv/UserError/g'
find . -type f -name '*.py' | xargs sed -i 's/osv\./models./g'
find . -type f -name '*.py' | xargs sed -i 's/\<orm\./models./g'
find . -type f -name '*.py' | xargs sed -i 's/\(import .*\), osv/\1, models/g'
@yelizariev
yelizariev / fix-travis.sh
Last active January 8, 2025 09:21
Script to fix lint travis errors on odoo. OBSOLETE. Latest version is here: https://odoo-development.readthedocs.io/en/latest/dev/lint/index.html
# fix line break symbols
find * -type f | grep -v ".\(svg\|png\|jpg\)$" | xargs sed -i 's/\r//g'
# trim trailing whitespaces
find * -type f | grep -v ".\(svg\|png\|jpg\)$" | xargs sed -i 's/[ \t]*$//g'
#PEP8 для py-файлов:
autopep8 --in-place -r --aggressive --aggressive --ignore E501 ./
# fix CamelCase
# PS1 for remote root
# \t \h \w\$
export PS1='\[\033[00;31m\]\t \[\033[01;31m\]\h \[\033[01;34m\]\w\[\033[01;31m\]\$\[\033[00m\] '
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt
@yelizariev
yelizariev / print-pdf-on-ticket-printer.md
Last active November 13, 2018 19:09
How-to print pdf on a ticket printer.

Instruction provided by @invitu

1- Install Cups on the posbox:

  • The posbox is a read-only system, you have to chroot it to install cups
  • Run a posbox on a raspberry-pi and plug a pen drive containing another posbox image
  • chroot the posbox in the pen drive
  • install cups with apt-get
  • plug the epson on the posbox
  • setup a Raw queue using usb://EPSON/TM-T20II in cups and share it (remove the "?serial=xxxxxxx" part if you want to use the image with another printer
  • there is no driver for epson printer for raspbian, that's the reason we must use raw queue
@yelizariev
yelizariev / 1-Constitution.md
Last active February 20, 2021 00:05
IT-Projects LLC rules. The document is moved to https://gitlab.com/itpp/handbook/

Constitution explains how and in what direction is the company growing

I. Just work well

  • The only way to compensate poorly made work is to improve yourself and do it well

I.1. No penalties

  • There are no any financial, moral, administrative penalties

I.2. No excuses

  • Inside the company, excuses have no sense