Skip to content

Instantly share code, notes, and snippets.

View Basje's full-sized avatar
Solving Advent of Code

Bas Basje

Solving Advent of Code
  • The Netherlands
View GitHub Profile
@Basje
Basje / postgres_emailaddress_domain.sql
Last active July 5, 2017 12:49
Simple e-mailaddress domain for Postgres
CREATE DOMAIN public."emailAddress" AS public.citext;
ALTER DOMAIN public."emailAddress" OWNER TO some_owner;
ALTER DOMAIN public."emailAddress" ADD CONSTRAINT emailaddress_must_not_exceed_maximum_length CHECK( char_length( VALUE ) < 255 );
ALTER DOMAIN public."emailAddress" ADD CONSTRAINT emailaddress_must_contain_exactly_one_at CHECK( VALUE ~ '^[^@]*@[^@]*$' );
ALTER DOMAIN public."emailAddress" ADD CONSTRAINT emailaddress_domain_must_contain_at_least_one_dot CHECK( VALUE ~ '@.*\.' );
ALTER DOMAIN public."emailAddress" ADD CONSTRAINT emailaddress_domain_must_not_end_with_dot CHECK( VALUE ~ '@.*[^\.]$' );
ALTER DOMAIN public."emailAddress" ADD CONSTRAINT emailaddress_domain_must_not_start_with_dot CHECK( VALUE ~ '@[^\.].*$' );
ALTER DOMAIN public."emailAddress" ADD CONSTRAINT emailaddress_local_part_must_not_be_empty CHECK( VALUE ~ '.+@' );
ALTER DOMAIN public."emailAddress" ADD CONSTRAINT emailaddress_local_part_must_not_end_with_dot CHECK( POSITION('.@' in VALUE) = 0 );
@Basje
Basje / secure-tls
Created September 15, 2016 06:59
Secure TLS configuration for Nginx, with decent browser support
## Include this file in your `server` block listening to secure connections, probably on port 443.
## You can use this statement: `include conf.d/secure-tls;`
## For more information about the settings, please read the following articles:
# - https://wiki.mozilla.org/Security/Server_Side_TLS
# - https://mozilla.github.io/server-side-tls/ssl-config-generator/
# - https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
# Certs sent to the client in SERVER HELLO are concatenated in ssl_certificate.
# This improves performance by avoiding the costly session negotiation process where possible
@Basje
Basje / keybase.md
Created August 10, 2016 08:45
Keybase.io verification

Keybase proof

I hereby claim:

  • I am basje on github.
  • I am basje (https://keybase.io/basje) on keybase.
  • I have a public key whose fingerprint is 5DFB A512 733F 6B03 CF34 DC6A A9DF 1B85 3CEC 67D9

To claim this, I am signing this object: