Skip to content

Instantly share code, notes, and snippets.

# Adds the current branch to the bash prompt when the working directory is
# part of a Git repository. Includes color-coding and indicators to quickly
# indicate the status of working directory.
#
# To use: Copy into ~/.bashrc and tweak if desired.
#
# Based upon the following gists:
# <https://gist.github.com/henrik/31631>
# <https://gist.github.com/srguiwiz/de87bf6355717f0eede5>
# Modified by me, using ideas from comments on those gists.
#!/bin/bash
alias kl="kubectl"
alias klgs="kubectl get services"
alias klgp="kubectl get pods; echo $1"
# get pods for a service by name
# e.g. klgp ms-reports
klgpn() {
app=$1
service: openvidu-autoscaling
provider:
name: aws
runtime: nodejs10.x
memorySize: 128
timeout: 900
region: us-east-1
stage: production
tags:
// ----------------------------------------------
// src/utils/index.js
const R = require('ramda')
const pMap = require('p-map')
// concurrently :: Int -> (a -> Promise b) -> [a] -> Promise [b]
const concurrently = R.curry((concurrency, mapper, list) =>
pMap(
list,
service: openvidu-autoscaling
provider:
name: aws
runtime: nodejs10.x
memorySize: 128
timeout: 60
region: us-east-1
stage: production
tags:
// ----------------------------------------------
// src/config/index.js
// configuration received as environment variables
module.exports = {
openvidu: {
url: process.env.OPENVIDU_SERVER_URL,
username: process.env.OPENVIDU_API_USERNAME,
password: process.env.OPENVIDU_API_SECRET,
},
AWSTemplateFormatVersion: 2010-09-09
Description: CloudFormation template responsible for creating the resources for the OpenVidu media node autoscaling solution
Resources:
# CloudWatch Alarm
CPUAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: CPU alarm for my instance
# send event to `TelemedicineTelemetryAlarmTopic`
AlarmActions:
const Koa = require('koa')
const router = require('koa-router')
const app = new Koa()
const router = new Router()
const index = ctx => {
ctx.body = 'Node.JS do zero ao deploy'
}
const port = process.env.PORT || 3000
app
.listen(port)
.on('listening', () => console.log(`Listening on port ${port}`))
const hello = ctx => {
const name = ctx.params.name || 'World'
ctx.body = `Hello ${name}!`
}
router.get('/hello', hello)
router.get('/hello/:name', hello)