Skip to content

Instantly share code, notes, and snippets.

@akhdaniel
akhdaniel / odoo wkhtmltopdf centos
Last active January 17, 2019 03:18
odoo wkhtmltopdf centos
I found out that the packaged versions do not work (even the most recent)
The solution is to download and install the packaged version then do a manual install of a different version so you get the libraries from the packaged version and use the executables only from version 12.4
After this no more empty reports on CentOS
##Install the packaged version via:
yum install wkhtmltopdf
##Note Ubuntu works fine. This is for CentOS
cd ~
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
#!/bin/bash
/usr/local/bin/pgbadger -I -q ssh://[email protected]//var/log/postgresql/postgresql-9.5-main.log.* -O /var/www/html/pgbadger/db -f s
tderr --prefix '%t [%p-%l] %q%u@%d '
/usr/local/bin/pgbadger -I -q ssh://[email protected]//var/log/postgresql/postgresql-9.5-main.log -O /var/www/html/pgbadger/shafco -f stde
rr --prefix '%t [%p-%l] %q%u@%d '
-- biggest table record
SELECT schemaname || '.' || relname as table,n_live_tup as num_rows
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC LIMIT 10;
-- biggest table size
SELECT nspname|| '.' || relname as table,
pg_size_pretty(pg_total_relation_size(C.oid)) AS total_size
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
#!/bin/bash
# sesuaikan dengan lokasi folder PG masing-masing
PGDATA=/var/lib/postgresql/9.5/main
pid=`head -1 $PGDATA/postmaster.pid`
echo "Pid: $pid"
peak=`grep ^VmPeak /proc/$pid/status | awk '{ print $2 }'`
echo "VmPeak: $peak kB"
hps=`grep ^Hugepagesize /proc/meminfo | awk '{ print $2 }'`
echo "Hugepagesize: $hps kB"
hp=$((peak/hps))
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# (The "=" is optional.) Whitespace may be used. Comments are introduced with
# "#" anywhere on a line. The complete list of parameter names and allowed
[options]
addons_path = /Users/daniel/odoo10/odooc/odoo/addons,/Users/daniel/odoo10/addons10
admin_passwd = admin
csv_internal_sep = ,
data_dir = /Users/odoo/Odoo
db_host = localhost
db_maxconn = 64
db_password = openerp
@akhdaniel
akhdaniel / pos.diff
Created December 14, 2018 03:51 — forked from nim-odoo/pos.diff
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 9b222f1..4492457 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -1889,7 +1889,8 @@ exports.Order = Backbone.Model.extend({
}
return zero_pad(this.pos.pos_session.id,5) +'-'+
zero_pad(this.pos.pos_session.login_number,3) +'-'+
- zero_pad(this.sequence_number,4);
+ zero_pad(this.sequence_number, 4) +'-'+
@akhdaniel
akhdaniel / gist:32fbeaa3ea723ddff00b8a7baf9a533a
Created December 13, 2018 01:01 — forked from shadowmint/gist:7004832
Kivy example using sqlalchemy to build a layout.
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship, backref
from kivy.graphics import Rectangle
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.widget import Widget
@akhdaniel
akhdaniel / Python3 Virtualenv Setup.md
Created November 21, 2018 05:20 — forked from pandafulmanda/Python3 Virtualenv Setup.md
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

Requirements
  • Python 3
  • Pip 3
$ brew install python3
# Setup an appropriate nginx log_format in the `http` section of your nginx config:
log_format main '$remote_addr $time_iso8601 "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_host" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$request_time ';
# Then save the following as a munin plugin to monitor the last 5 minutes of your nginx access.log file