Skip to content

Instantly share code, notes, and snippets.

View firstDismay's full-sized avatar

Dmitry Ivanov firstDismay

  • BAG
  • Russian Federation
View GitHub Profile
@portnov
portnov / test.sql
Created June 30, 2022 19:01
nvl2 SQL vs pl/pgsql
create or replace function nvl2(expr1 anycompatible, expr2 anycompatible, expr3 anycompatible) returns anycompatible as $$
select case when expr1 is null then expr2 else expr3 end;
$$ language sql immutable;
create or replace function nvl2pg(expr1 anycompatible, expr2 anycompatible, expr3 anycompatible) returns anycompatible as $$
begin
if expr1 is null then
return expr2;
else
return expr3;
@jkatz
jkatz / encrypt_password.py
Last active March 26, 2024 16:37
Methods to create password verifiers for PostgreSQL
# Copyright 2019-2022 Jonathan S. Katz
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@rdnvndr
rdnvndr / PgAdmin4-Nginx-uwsgi.md
Last active November 5, 2022 14:33
Установка PgAdmin4 + Nginx + uwsgi

Установка PgAdmin4 + Nginx + uwsgi

Установка PgAdmin 4

Для установки PgAdmin 4 через pip необходимо выполнить команды:

sudo apt-get install python3-pip build-essential python3-dev libssl-dev libffi-dev
sudo pip3 install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v6.15/pip/pgadmin4-6.15-py3-none-any.whl

Для инициализации конфигурации в директории /usr/local/lib/python3.5/dist-packages/pgadmin4/ необходимо создать файл config_local.py:

@lon-io
lon-io / self-signed-ssl-certificate.md
Created August 8, 2018 15:23 — forked from clemlatz/self-signed-ssl-certificate.md
Setup a self-signed SSL certificate with Nginx (server and browser)

1. Configure server: Nginx

Create the certificate:

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt

Create a strong Diffie-Hellman group:

$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048