Skip to content

Instantly share code, notes, and snippets.

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

Daniel Kotik DanielKotik

💭
I may be slow to respond.
View GitHub Profile
@DanielKotik
DanielKotik / 1_smime-clients.md
Created November 30, 2022 13:51 — forked from rmoriz/1_smime-clients.md
S/MIME is the industry standard for secure E-Mail and build into every relevant mail client. From Outlook to Thunderbird, from Blackberry to Apple Mail on OSX and iOS. http://smime.io/
@DanielKotik
DanielKotik / merge_git_repo_as_subdir
Created February 15, 2022 09:55 — forked from smdabdoub/merge_git_repo_as_subdir
Merge one git repository into another repository as a sub-directory
# based on the following:
# http://saintgimp.org/2013/01/22/merging-two-git-repositories-into-one-repository-without-losing-file-history/
# http://blog.caplin.com/2013/09/18/merging-two-git-repositories/
git clone repo_main
git clone repo_sub
cd repo_main
git remote add repo_sub ../repo_sub
git fetch repo_sub
# Install/update SOPS to latest on Fedora - https://github.com/mozilla/sops
echo "[+] Install/upgrade SOPS"
SOPS_VERSION=$(curl -s https://api.github.com/repos/mozilla/sops/releases/latest | jq .tag_name | tr -d '"')
dnf install -y https://github.com/mozilla/sops/releases/download/${SOPS_VERSION}/sops-${SOPS_VERSION}-1.x86_64.rpm
sops --version
# sops 3.2.0 (latest)
@DanielKotik
DanielKotik / psql-error-fix.md
Created September 17, 2021 12:19 — 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

# -*- coding: utf-8 -*-
"""Demonstrate high quality docstrings.
Module-level docstrings appear as the first "statement" in a module. Remember,
that while strings are regular Python statements, comments are not, so an
inline comment may precede the module-level docstring.
After importing a module, you can access this special string object through the
``__doc__`` attribute; yes, it's actually available as a runtime attribute,
despite not being given an explicit name! The ``__doc__`` attribute is also
@DanielKotik
DanielKotik / gist:45763bb09332b2665686772207458d6f
Created September 3, 2018 13:02 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@DanielKotik
DanielKotik / readme.md
Created August 31, 2018 11:50 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

@DanielKotik
DanielKotik / UDPClient.hpp
Last active September 5, 2018 08:52 — forked from kaimallea/UDPClient.hpp
Super simple UDP client using boost
/*
This Program uses OS independet boost library 'asio'.
Below are some web links for programming UDP sockets with linux specific libraries using functions: 'gethostbyname', 'bind' and
'socket'. Please note, however, that these functions are superseded by 'getaddrinfo' and 'getnameinfo' nowadays. These functions
provide better support for IPv6.
https://www.ibm.com/developerworks/library/wa-ipv6.html
http://openbook.rheinwerk-verlag.de/linux_unix_programmierung/Kap11-016.htm#RxxKap11016040003951F04F100
https://www.cs.rutgers.edu/~pxk/417/notes/sockets/udp.html
@DanielKotik
DanielKotik / SetMidpoint.py
Created April 19, 2018 11:01 — forked from bdjackson/SetMidpoint.py
Setting the midpoint of a matplotlib colormap
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
class MidpointNormalize(mpl.colors.Normalize):
"""
class to help renormalize the color scale
"""
def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
self.midpoint = midpoint