Skip to content

Instantly share code, notes, and snippets.

@fabriciocolombo
fabriciocolombo / gist:3405794
Created August 20, 2012 16:58
PostgreSQL Backup/Restore
pg_dump.exe --host $host --port 5432 --username $userName --format plain --create --verbose --file $fileName $databaseName
To restore backup done with plain format
psql -a -h $host -p 5432 -U $user -d $database -f $fileName -o restore.log
To restore backup done with other format
pg_restore -h $host -U $user --verbose -d $databaseName -C $backupFileName [2> restore.log]
@fabriciocolombo
fabriciocolombo / gist:3430899
Created August 23, 2012 00:43
Pentaho Basic Config

Admin console

user: admin
password: password

BI server

user: joe
password: password
@fabriciocolombo
fabriciocolombo / gist:3555254
Created August 31, 2012 16:14
GitHub commit + issues

Synonyms to close an issue with commit message

  • fixes #xxx
  • fixed #xxx
  • fix #xxx
  • closes #xxx
  • close #xxx
  • closed #xxx
@fabriciocolombo
fabriciocolombo / gist:3721539
Created September 14, 2012 12:00
Hibernate Connection Leak on Lazy Load
Testing spring web flow with hibernate option AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS enabled to verify if the connection leak on Lazy Load without transaction disappear
https://hibernate.onjira.com/browse/HHH-7524
@fabriciocolombo
fabriciocolombo / gist:3732735
Created September 16, 2012 14:56
BSONArray modify
procedure ReplaceArray;
var
vPerson: IBSONObject;
vAddresses,
vNewAddresses: IBSONArray;
begin
//Insert person
vAddresses := TBSONArray.NewFromValues(['one address', 'two address']);
vPerson := TBSONObject.NewFrom('id', 1).Put('name', 'fabricio').Put('addresses', vAddresses);
FCollection.Save(vPerson);
@fabriciocolombo
fabriciocolombo / http_codes_family.md
Created September 26, 2012 11:51 — forked from rponte/http_codes_family.md
HTTP codes, we are family

HTTP codes, we are family

Above we have looked at just a few of the available HTTP codes; there are many others. Some are very well-known, such as 404 Not Found, but others are quite obscure and don't crop up very often. Whatever the case, the first digit is always an indication of the family of codes they belong to:

  • 1xx (Informational): Request received, continuing process.
  • 2xx (Successful): The action was successfully received, understood, and accepted.
  • 3xx (Redirection): Further action needs to be taken in order to complete the request.
  • 4xx (Client Error): The request contains bad syntax or cannot be fulfilled.
  • 5xx (Server Error): The server failed to fulfil an apparently valid request.
@fabriciocolombo
fabriciocolombo / gist:4119771
Last active October 13, 2015 01:47
PostgreSQL - Change Owner
select 'ALTER FUNCTION ' || quote_ident(routine_schema) || '.' || quote_ident(routine_name) || ' OWNER TO ' ||routine_schema || ';'
from information_schema.routines
where specific_schema NOT LIKE E'pg\\_%'
and specific_schema <> 'information_schema'
and specific_schema <> 'public'
/*AND specific_schema = $YourSchema leave commented for all */
union all
SELECT 'ALTER TABLE ' || quote_ident(s.nspname) || '.' || quote_ident(s.relname) || ' OWNER TO ' || nspname || ';'
FROM (SELECT nspname, relname
FROM pg_class c
@fabriciocolombo
fabriciocolombo / gist:4279304
Created December 13, 2012 20:00
Capturing console output with Delphi
//Anonymous procedure approach by Lars Fosdal
type
TArg<T> = reference to procedure(const Arg: T);
procedure TForm1.CaptureConsoleOutput(const ACommand, AParameters: String; CallBack: TArg<PAnsiChar>);
const
CReadBuffer = 2400;
var
saSecurity: TSecurityAttributes;
hRead: THandle;
From http://www.cesarromero.com.br/script-para-baixar-atualizacoes-de-repositorios-subversion-mercurial-e-git
@echo off
::--------------------------------------------------------------------------
:: Copyright (c) 2012-2013, Cesar Romero
:: All rights reserved.
::
:: Code license Mozilla Public License 1.1
::
:: Redistribution and use in source and binary forms, with or without
Revert último commit
$ git commit ... //Commit equivocado
$ git reset --soft HEAD^ //Desfaz commit
Revert added file
$ git add [file]
$ git reset [file]