Skip to content

Instantly share code, notes, and snippets.

View jimmytuc's full-sized avatar
💭
I may be slow to respond.

Foo jimmytuc

💭
I may be slow to respond.
  • Viet Nam
View GitHub Profile
FROM python:3.7-alpine3.8
RUN apk add --no-cache \
build-base \
cmake \
bash \
jemalloc-dev \
boost-dev \
autoconf \
zlib-dev \
FROM python:3.7-alpine3.8
RUN apk add --no-cache \
build-base \
cmake \
bash \
jemalloc-dev \
boost-dev \
autoconf \
zlib-dev \
@jimmytuc
jimmytuc / python
Created June 18, 2019 07:10
flatten-df-columns
def flatten_dataframe(df, columns, fillna_value='', preserve_index=False):
if (columns is not None \
and len(columns) > 0 \
and not isinstance(columns, (list, tuple, np.ndarray, pd.Series))):
columns = [columns]
diff_columns = df.columns.difference(columns)
# get column's series of length
series_length = df[columns[0]].str.len()
Popular ami image: ami-0da245167866d25b1
@jimmytuc
jimmytuc / psql-error-fix.md
Created September 13, 2022 01:15 — 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