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
I got it working | |
```python | |
import base64 | |
import urllib.request | |
import ssl | |
try: | |
import json | |
except ImportError: | |
import simplejson as json |
We are implementing database dumping which is straightforward but can be tedious to setup. Here's our setup:
- Create AWS user for db backups (e.g.
db-backups-{{app}}
)- Save credentials in a secure location
- If adding db scrubbing, use a separate user (e.g
db-scrubs-{{app}}
)
- Create bucket for S3 access logging (e.g.
s3-access-log-{{app}}
) - Create consistently named bucket for db dumps (e.g.
db-backups-{{app}}
)- Enable logging to
s3-access-log-{{app}}
with prefix ofdb-backups-{{app}}
- Enable logging to
- Add IAM policy for bucket access
- Select user -> Choose "Add inline policy"
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
/** | |
* Generates number of random geolocation points given a center and a radius. | |
* @param {Object} center A JS object with lat and lng attributes. | |
* @param {number} radius Radius in meters. | |
* @param {number} count Number of points to generate. | |
* @return {array} Array of Objects with lat and lng attributes. | |
*/ | |
function generateRandomPoints(center, radius, count) { | |
var points = []; | |
for (var i=0; i<count; i++) { |
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
const redisClient = redis.createClient(REDIS_URL); | |
const listeners = Object.create(null); | |
function addListener(channel, listener) { | |
if (!listeners[channel]) { | |
listeners[channel] = []; | |
redisClient.subscribe(channel); | |
} | |
listeners[channel].push(listener); |
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
'use strict' | |
const timeout = ms => new Promise(res => setTimeout(res, ms)) | |
function convinceMe (convince) { | |
let unixTime = Math.round(+new Date() / 1000) | |
console.log(`Delay ${convince} at ${unixTime}`) | |
} | |
async function delay () { |