Skip to content

Instantly share code, notes, and snippets.

View vinnix's full-sized avatar

Vinícius Abrahão Bazana Schmidt vinnix

View GitHub Profile
@vinnix
vinnix / myLilLibrary.c
Created October 30, 2013 16:03
Exemplo de biblioteca em linguagem C, para utilizar dentro do PostgreSQL / plpgsql.
#include "postgres.h"
#include <sys/file.h>
#include <sys/stat.h>
#include <unistd.h>
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "postmaster/syslogger.h"

Preparing Jboss environment

Create Jboss user and group

Create a group for a system user (daemnos and program users like www-data, mysql...)

# addgroup --system jboss

Create a user (system user, without home -> See below the command, to the jboss group and no login shell)

vinicius.schmidt@dls110:~$ export PGSERVICE=a4c_dump_test
vinicius.schmidt@dls110:~$ psql9
psql9 (9.2.1, server 9.1.5)
WARNING: psql9 version 9.2, server version 9.1.
Some psql features might not work.
Type "help" for help.
a4c_dump_test=> \d
No relations found.
a4c_dump_test=> \l
@vinnix
vinnix / fb_ok.dns
Created December 10, 2012 23:38
Facebook's DNS is working at Sao Paulo/Brazil
vnxs:~ Vinnix$ dig www.facebook.com
; <<>> DiG 9.4.3-P3 <<>> www.facebook.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19911
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.facebook.com. IN A
@vinnix
vinnix / fb_fail.dns
Created December 10, 2012 23:06
Facebook's DNS is bug
vnxs:~ Vinnix$ dig www.facebook.com
; <<>> DiG 9.4.3-P3 <<>> www.facebook.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 19977
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.facebook.com. IN A
@vinnix
vinnix / restore_weird_behavior.log
Created October 18, 2012 17:52
weird pg_restore behavior
Looking about a weird scenario, when I try to restore only one table from a dump,
but the restore does not work, without any errors.
$ psql -d postgres
psql (9.1.3)
Type "help" for help.
postgres=# create database my_poc;
CREATE DATABASE
postgres=# not null default nextval('testschema.testtable_id_seq'::regclass)
root (hd0)
Filesystem type is ext2fs, using whole disk
kernel /boot/vmlinuz-2.6.32-279.5.2.el6.x86_64 ro root=/dev/xvda1 init=/sbin/in
it rootfstype=ext3
@vinnix
vinnix / error.txt
Created August 31, 2012 15:38
how can I remove, this directory?
[root@dls118 /usr/ports/irc/irchat-pj-emacs21]# ls -la
total 0
[root@dls118 /usr/ports/irc/irchat-pj-emacs21]# cd ..
[root@dls118 /usr/ports/irc]# rm -rf irchat-pj-emacs21/
g_vfs_done():ada0a[READ(offset=11719696384, length=4096)]error = 5
rm: irchat-pj-emacs21/: Directory not empty
postgres=# \l+
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges | Size | Tablespace | Description
------------+------------+----------+-----------+-------+-----------------------+---------+---------------+---------------------------
biocinese | site | LATIN1 | en_US | en_US | =Tc/site | 7078 kB | ts_biocinese |
: site=CTc/site
: qualidade=CTc/site
curriculo | intranet | LATIN1 | en_US | en_US | | 21 MB | ts_curriculo |
firewall | giovanni | LATIN1 | en_US | en_US | | 5670 kB | ts_firewall |
intranet | intranet | LATIN1 | en_US | en_US | intranet=CTc/intranet | 2167 MB | ts_intranet |
@vinnix
vinnix / postgresql.conf.diff
Created May 28, 2012 16:56
postgresql conf. primeiras mudanças
240c240
< logging_collector = off # Enable capturing of stderr and csvlog
---
> logging_collector = on # Enable capturing of stderr and csvlog
248c248
< log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
---
> log_filename = 'postgresql-%a.log' # log file name pattern,
268c268
< silent_mode = on # Run server silently.