Skip to content

Instantly share code, notes, and snippets.

-- 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
/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 '
@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
Widget:
Widget is different or alternate representation to display a screen, fields and attributes in odoo.
Widget allows to change view using different rendering templates and also allows to design as you want.
Example:
widget_name.js
@akhdaniel
akhdaniel / Nginx Monitoring Plugin
Created January 17, 2019 22:29
Nginx Monitoring Plugin
sudo apt-get install libwww-perl
Edit nginx.conf, bagian http
Test curl http://localhost/nginx_status
server {
listen 127.0.0.1;
server_name localhost;
location /nginx_status {
@akhdaniel
akhdaniel / CARA RENEW CERTIFICATE HORIZON REMCASH
Created January 26, 2019 22:24
CARA RENEW CERTIFICATE HORIZON REMCASH
ssh root@horizon
cd /etc/letsencrypt/live/horizon.remcash.com/
certbot certonly --force-renew -d horizon.remcash.com
systemctl restart stellar-horizon.service
@akhdaniel
akhdaniel / Filter domain dynamic date
Last active December 3, 2019 09:26
Odoo Filter Today
<filter string="Today" name="today" domain="[('date_start','&gt;=',time.strftime('%%Y-%%m-%%d'))]"/>
<filter string="This Month" name="thismonth" domain="[('date_start','&gt;=',time.strftime('%%Y-%%m-01'))]"/>
<filter string="This Year" name="thisyear" domain="[('date_start','&gt;=',time.strftime('%%Y-01-01'))]"/>
<filter string="Today" domain="[('start_at', '>=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" />
@akhdaniel
akhdaniel / Linux Kernel Tuning
Last active April 1, 2019 02:11
Kernel Tuning
vm.overcommit_memory=2
vm.swappiness=0
vm.dirty_ratio=2
vm.dirty_background_ratio=1
vm.nr_hugepages=4287
Harus enable Windows Script Host:
edit dari regedit:
LOCAL_MACHINE/Software/Microsoft/Windows Script Host/Settings
CURRENT_USER/Software/Microsoft/Windows Script Host/Settings
Key: Enable
Type: DWORD
Value: 1
@akhdaniel
akhdaniel / Python Download Youtube videos
Last active June 10, 2019 07:25
Python Download Youtube videos
#pip install youtube-dl
#create data.txt berisi ID video youtube per baris
# misalnya URL https://www.youtube.com/watch?v=qZ-ouYWCASo&feature=youtu.be
# ID nya adalah qZ-ouYWCASo
while read p; do
echo "$p"
youtube-dl -f best https://youtube.com/watch?v=$p
done < data.txt