This file contains hidden or 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
#!/usr/bin/env python3 | |
import os | |
import pprint | |
import boto3 | |
from pymongo import MongoClient | |
pp = pprint.PrettyPrinter(indent=2) | |
dbName = os.environ['MONGO_DB_NAME'] | |
dbReplicaSet = os.environ['MONGO_REPLICA_SET'] |
This file contains hidden or 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
################################## NETWORK ##################################### | |
bind 0.0.0.0 | |
protected-mode no | |
port 6379 | |
tcp-backlog 511 | |
## Close the connection after a client is idle for N seconds (0 to disable) | |
timeout 0 | |
## ACK time period |
This file contains hidden or 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
#!/usr/bin/env python3 | |
''' | |
Send Redis usage metrics to CloudWatch | |
''' | |
import redis | |
import json | |
import boto3 | |
import os |
This file contains hidden or 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
#!/usr/bin/env python3 | |
''' | |
Send rabbitmq queue data to cloudwatch | |
''' | |
import boto3 | |
import os | |
import json | |
import requests |
This file contains hidden or 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
#!/usr/bin/env python3 | |
# Machine info on EC2 linux machines | |
import re | |
import os | |
import boto3 | |
machine = os.environ['MACHINE_NAME'] | |
region = os.environ['AWS_REGION'] |
This file contains hidden or 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
#!/usr/bin/env bash | |
# Setup for gathering metrices, debian based | |
required_env='AWS_REGION, MONITOR_DISKS, MACHINE_NAME'; | |
function checkEnv() { | |
echo "Checking $1" | |
local val=$(env | grep "$1") | |
echo $val |
This file contains hidden or 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
function updateOrUpsertMany(mongo, col, docs) { | |
const bulk = mongo.colection(col).initializeUnorderedBulkOp(); | |
docs.forEach(doc => { | |
bulk.find({ _id: doc._id }).upsert().updateOne({ $set: doc }); | |
}); | |
if (docs.length > 0) { | |
return bulk.execute() | |
.catch((ex) => { | |
if (ex.message.indexOf('E11000 duplicate key error collection') !== -1) { | |
return this.updateOrUpsertMany(mongo, col, docs); |
This file contains hidden or 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
#!/usr/bin/env python3 | |
""" | |
Create ssh shortcut alias | |
""" | |
import boto3 | |
ec2 = boto3.client('ec2') |
This file contains hidden or 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
/** | |
* @class QError | |
*/ | |
class QError extends Error { | |
/** | |
* @param {string} message | |
* @param {string} [type=error] | |
* @param {Object} [cause=null] - extra data for debugging | |
*/ |
This file contains hidden or 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'; | |
/** | |
* ============================================================================================= | |
* A state container | |
* @exports {Object} Continer | |
* | |
* // in the very beginning | |
* const con = require('container.js') | |
* con.add('logger', new Logger('log')); |
NewerOlder