Skip to content

Instantly share code, notes, and snippets.

View ivanelson's full-sized avatar

Ivanelson Nunes ivanelson

  • Teresina, PI - BR
View GitHub Profile
@ivanelson
ivanelson / well.sql
Created August 10, 2018 12:28
add contrainst unique table already exists
ALTER TABLE dbatez.rec_filial drop COLUMN pk_rec_filial;
ALTER TABLE dbatez.rec_filial ADD COLUMN pk_rec_filial bigserial UNIQUE;
ALTER TABLE dbatez.rec_filial ALTER COLUMN pk_rec_filial SET NOT NULL;
ALTER TABLE dbatez.rec_filial ALTER COLUMN pk_rec_filial SET DEFAULT nextval('dbatez.rec_filial_pk_rec_filial_seq'::regclass);
update dbatez.REC_FILIAL set pk_rec_filial = pk_rec_filial;
-- passar o ultimo elementro da sequence
select max(pk_rec_filial) from dbatez.rec_filial;
@ivanelson
ivanelson / .vimrc
Created April 17, 2018 18:43
Meu vim
execute pathogen#infect()
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
let g:syntastic_auto_loc_list=2
let g:syntastic_check_on_open = 1
@ivanelson
ivanelson / my.cfg
Created May 22, 2017 22:19
rundeck
#Mon May 22 19:19:14 BRT 2017
#edit below
ansible-ssh-auth-type=privateKey
ansible-ssh-key-storage-path=keys/id_rsa.ansible
project.ansible-become-method=sudo
project.ansible-become-user=ansible
project.ansible-executable=/bin/bash
project.ansible-ssh-auth-type=privateKey
project.ansible-ssh-key-storage-path=keys/id_rsa.ansible
project.ansible-ssh-user=ansible
@ivanelson
ivanelson / my_func_plpgsql.sql
Created May 17, 2017 18:00
Sqitch with Declare
BEGIN;
-- XXX Add DDLs here.
DO $$
DECLARE
mydata date;
BEGIN
SELECT INTO mydata CURRENT_DATE;
IF mydata = '2017-03-21' THEN
insert INTO log_os (codfili, codorde,codtecn, hr_log, dt_log, cd_usuario, cd_senha, nr_log,no_historico)
@ivanelson
ivanelson / langids.py
Created August 22, 2016 14:15
langids
def langids(self):
print "metodo langids..."
""" Return the USB device's supported language ID codes.
These are 16-bit codes familiar to Windows developers, where for
example instead of en-US you say 0x0409. USB_LANGIDS.pdf on the usb.org
developer site for more info. String requests using a LANGID not
in this array should not be sent to the device.
This property will cause some USB traffic the first time it is accessed
@ivanelson
ivanelson / pdf.py
Created August 2, 2016 13:37
pdf via reportlab
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
from reportlab.pdfgen import canvas
c = canvas.Canvas("ola.pdf")
c.drawString(100,750,"Bem-vindo ao Reportlab!")
c.save()
ivan:~/src/vagrant/precise32$ vagrant up
/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /home/ivan/zim712pg in PATH, mode 040777
/opt/vagrant/embedded/gems/gems/bundler-1.7.11/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /home/ivan/zim712pg in PATH, mode 040777
Bringing machine 'pdv' up with 'virtualbox' provider...
Bringing machine 'base' up with 'virtualbox' provider...
==> pdv: Box 'pdv' could not be found. Attempting to find and install...
pdv: Box Provider: virtualbox
pdv: Box Version: >= 0
==> pdv: Adding box 'pdv' (v0) for provider: virtualbox
pdv: Downloading: pdv
git log --pretty="%H %ci" --after=2015-06-03 --before=2015-06-05
@ivanelson
ivanelson / between.sql
Created May 18, 2015 13:41
Between - Diferença entre Postgres e Oracle
ORACLE:
- cd_chave_la varchar2(6)
SELECT cd_chave_la from tab_inaugura where cd_chave_la between 'TEZ 1 ' and 'TEZ 1Z';
// OUTPUT:
"TEZ 1S"
POSTGRESQL
- cd_chave_la varchar(6)
@ivanelson
ivanelson / gist:392042633f32b56eb23c
Created May 6, 2015 14:33
git log search by date
$ git log --pretty=fuller --until="2015-04-25" --after="2015-04-24"
commit d58d89a0f1cf48f6905857c00edc70073457f9a6
Merge: b12802c 44f16e5
Author: silvajr <[email protected]>
AuthorDate: Fri Apr 24 14:17:04 2015 -0300
Commit: silvajr <[email protected]>
CommitDate: Fri Apr 24 14:17:04 2015 -0300