These words come from Act 1, Scene 3 of Hamlet, Laertes is about to embark for France to attend the university. His father Polonius gives him the following famous lines of advice:
Give thy thoughts no tongue,
Nor any unproportion’d thought his act.
Be thou familiar, but by no means vulgar.
Those friends thou hast, and their adoption tried,
Grapple them to thy soul with hoops of steel;
But do not dull thy palm with entertainment
Of each new-hatch’d, unfledged comrade.
Beware Of entrance to a quarrel; but being in,
Bear’t that the opposed may beware of thee.
Give every man thy ear, but few thy voice;
Take each man’s censure, but reserve thy judgment.
Costly thy habit as thy purse can buy,
But not express’d in fancy; rich, not gaudy;
For the apparel oft proclaims the man,
And they in France of the best rank and station.
Are of a most select and generous, chief in that.
Neither a borrower nor a lender be;
For loan oft loses both itself and friend,
And borrowing dulls the edge of husbandry.
This above all: to thine own self be true,
And it must follow, as the night the day,
Thou canst not then be false to any man.