Skip to content

Instantly share code, notes, and snippets.

@kokorolx
kokorolx / ror-association.md
Created April 10, 2019 07:20 — forked from kieetnvt/Crying with Rails Associations.md
Crying with Rails Associations

Crying with Rails Associations

Belongs To:

class Post < ApplicationRecord
  belongs_to :user
end

create_table :photos do |t|
@kokorolx
kokorolx / psql-error-fix.md
Created April 10, 2020 02:37 — forked from AtulKsol/psql-error-fix.md
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

@kokorolx
kokorolx / sublime-merge-command-line.md
Created October 12, 2021 06:42 — forked from SuryaElite/sublime-merge-command-line.md
Launch Sublime Merge from the command line on OSX

Launch Sublime Merge from the command line on OSX

Sublime Merge includes a command line tool, smerge, to work with git, subversion, mercurial projects on the command line. This can be used to open projects in Sublime Merge using the command line.

Requirements

  • Sublime Merge installed in your system within Applications folder

Setup