This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import hashlib | |
import hmac | |
import re | |
import secrets | |
import socket | |
class SCRAMAuthentication(object): | |
AUTHENTICATION_METHOD = b"SCRAM-SHA-256" | |
DIGEST = hashlib.sha256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir postgres | |
cd postgres | |
docker volume create --driver local --name=pgvolume | |
docker volume create --driver local --name=pga4volume | |
docker network create --driver bridge pgnetwork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir postgres | |
cd postgres | |
docker volume create --driver local --name=pgvolume | |
docker volume create --driver local --name=pga4volume | |
docker network create --driver bridge pgnetwork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/media/img/docs/books/plpgsql_y_otros_lenguajes.jpg b/media/img/docs/books/plpgsql_y_otros_lenguajes.jpg | |
new file mode 100644 | |
index 0000000..8c1e1ee | |
Binary files /dev/null and b/media/img/docs/books/plpgsql_y_otros_lenguajes.jpg differ | |
diff --git a/templates/pages/docs/books.html b/templates/pages/docs/books.html | |
index f798f8e..3bb4a49 100644 | |
--- a/templates/pages/docs/books.html | |
+++ b/templates/pages/docs/books.html | |
@@ -12,6 +12,22 @@ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.core.mail import send_mail | |
from django.db import models, transaction | |
from django.db.models.signals import post_save | |
from .tasks import * | |
class Contact(models.Model): | |
"""store contact information for emailing a user in the address book""" | |
user = models.ForeignKey(settings.AUTH_USER_MODEL, help_text="A reference to the User for the purpose of his/her address book") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/pgweb/account/admin.py b/pgweb/account/admin.py | |
index 09b51b4..beb1a01 100644 | |
--- a/pgweb/account/admin.py | |
+++ b/pgweb/account/admin.py | |
@@ -1,4 +1,7 @@ | |
from django.contrib import admin | |
+from django.contrib.auth.admin import UserAdmin | |
+from django.contrib.auth.forms import UserChangeForm | |
+from django.contrib.auth.models import User | |
from django import forms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\unset ECHO | |
\set QUIET true | |
\timing off | |
DROP TABLE IF EXISTS small_integers, integers, big_integers; | |
\unset QUIET | |
\set ECHO queries | |
\echo Creating and Interacting with Integers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH emails AS ( | |
SELECT e.id, split_part(e.email, '@', 1) || row_number() OVER (PARTITION BY split_part(e.email, '@', 1)) AS email | |
FROM email_addresses e | |
WHERE e.email !~ '@(domain|example).com$' AND e.email <> '' | |
) | |
UPDATE email_addresses e | |
SET email = emails.email || '@example.com' | |
FROM emails | |
WHERE e.id = emails.id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH old_rows AS ( | |
SELECT a, b, c | |
FROM update_me | |
WHERE blah = true | |
), new_rows AS ( | |
UPDATE update_me | |
SET a = 4, b = 5, c = 6 | |
FROM old_rows | |
WHERE blah = true | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# only supply or default logfile path when none is given explicitly in | |
# postgresql.conf | |
@options = ($pg_ctl, 'start', '-D', $info{'pgdata'}); | |
$logsize = 0; | |
if ($info{'logfile'}) { | |
push @options, ('-l', $info{'logfile'}); | |
# remember current size of the log | |
$logsize = (stat $info{'logfile'})[7]; | |
} |