Skip to content

Instantly share code, notes, and snippets.

vandamon vandamon

Block or report user

Report or block vandamon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vandamon
vandamon / print_fib.go
Created Jul 10, 2019
Print Fibonacci series up to n terms
View print_fib.go
package main
import (
"fmt"
)
func main() {
fmt.Println("Fibonacci series upto", 11, "terms is:")
printFib(11)
fmt.Println()
View install-postgresql-client-9.5-on-ubuntu-14.04.bash
# Ubuntu 14.04 repo
# For more repos see https://www.ubuntuupdates.org/ppa/postgresql?dist=trusty-pgdg
# Install key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# 14.04 repo
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
apt update
View golang-create-read-write-delete-file.go
package main
import (
"fmt"
"io"
"os"
)
var path = "/Users/novalagung/Documents/temp/test.txt"
@vandamon
vandamon / psql-error-fix.md
Created Sep 15, 2018 — forked from AtulKsol/psql-error-fix.md
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)
View psql-error-fix.md

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

View install-postgresql-9.6-in-ubuntu-16.04.md

Background

I believe Ubuntu 16.04 comes with PostgreSQL 9.5. Thats good for a start, but it is a matter of time before you have the need of a PostgreSQL 9.6 cluster. For me it was to import a PG backup from Heroku.

The procedure couldn't have been any easier and is described below. If you are interested in upgrading your old cluster to 9.6 afterwards, you may be interested in this.

Instructions

@vandamon
vandamon / Capybara.md
Created Apr 22, 2017 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet
View Capybara.md

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above
You can’t perform that action at this time.