Discover gists
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
''' | |
List of reserved usernames (pre-defined list of special banned and reserved keywords in names, | |
such as "root", "www", "admin"). Useful when creating public systems, where users can choose | |
a login name or a sub-domain name. | |
__References:__ | |
1. http://www.bannedwordlist.com/ | |
2. http://blog.postbit.com/reserved-username-list.html |
function Get-MsiProducts { | |
function Get-MsiUpgradeCode { | |
[CmdletBinding()] | |
param ( | |
[System.Guid]$ProductCode | |
, | |
[System.Guid]$UpgradeCode | |
) | |
function ConvertFrom-CompressedGuid { |
Thanks to new resources (postgresql_default_priviledges) and some fixes Terraform can now add new databases and manage ownership / access to them.
This example creates new database and two users. You can use owner to create new tables and run migrations and user for normal read/write access to database.
The following outlines how to setup Heroku + Cloudflare with a full SSL certificate. What this means is that communication between the browser and the Cloudflare CDN is encrypted as well as communication between Cloudflare and Heroku’s origin server. Follow these steps exactly and the setup is a breeze.
First you want to add the root domain and the www domain to heroku. You do this by clicking into your production application, then going to settings and then scrolling down to Domains and certificates.
Here you will add <your_domain>.com
and www.<your_domain>.com
. This will give you two CNAME records. They will look something like <your_domain>.com.herokudns.com
and www.<your_domain>.com.herokudns.com
.
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.
This assumes you have installed a docker swarm
When one has a docker swarm a container running on any node in the swarm can be accesed using any IP address of any swarm memeber.
For example if you had a single web server running on port 80, on one node of a swarm you could access the web server with any of the following IP addresses:
- server1-ip:80
- server2-ip:80
Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.
Source: tutorialspoint.com
This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.
Then, you can use Structlog loggers or standard logging
loggers, and they both will be processed by the Structlog pipeline (see the hello()
endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!
Requests are assigned a correlation ID with the asgi-correlation-id
middleware (either captured from incoming request or generated on the fly).
All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented.
This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog.
You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom