(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/bin/sh | |
| log_message() | |
| { | |
| MSG=$@ | |
| LOGTIMESTAMP=`date "+%Y-%m-%d-%H:%M:%S"` | |
| LOG_MSG="${LOGTIMESTAMP} Back-up from container $(hostname): ${MSG}" | |
| echo "${LOG_MSG}" | |
| } |
| import sys | |
| from os import environ | |
| from datetime import datetime | |
| from multiprocessing import Pool | |
| from azure.storage.queue import QueueServiceClient | |
| CONNECTION_STRING = environ.get('CONNECTION_STRING') | |
| import logging | |
| from logging.handlers import TimedRotatingFileHandler | |
| def get_logger(module_name): | |
| """ | |
| Get logger for all the modules | |
| """ | |
| logger = logging.getLogger(module_name) |
| # AWS S3 bucket for static hosting | |
| resource "aws_s3_bucket" "website" { | |
| bucket = "${var.website_bucket_name}" | |
| acl = "public-read" | |
| tags { | |
| Name = "Website" | |
| Environment = "production" | |
| } |
| #!/bin/bash | |
| usage() { | |
| echo "Usage $0 -c mongo_docker_container_name" | |
| } | |
| while [[ $# > 1 ]] | |
| do | |
| key="$1" |
| --- | |
| apiVersion: rbac.authorization.k8s.io/v1 | |
| kind: ClusterRole | |
| metadata: | |
| name: aws-node | |
| rules: | |
| - apiGroups: | |
| - crd.k8s.amazonaws.com | |
| resources: | |
| - "*" |
| @export ENIS=$$(aws ec2 describe-network-interfaces --filters "Name=status,Values=available" | jq ".NetworkInterfaces[] | select(.VpcId == \"$${VPC_ID}\") | .NetworkInterfaceId"); \ | |
| if [[ ! -z $${DRY_RUN} ]]; then \ | |
| echo "Running in dry run mode! No changes will be made. The following ENIs would be deleted:"; \ | |
| echo $${ENIS}; \ | |
| exit 0; \ | |
| else \ | |
| for eni in $$(echo $${ENIS}| tr -d "\""); \ | |
| do \ | |
| aws ec2 delete-network-interface --network-interface-id $${eni}; \ | |
| done; \ |
| #!/bin/bash | |
| # Wrapper around AWS session manager for instance access using public ip and private ip | |
| scriptname=$0 | |
| # Defaults | |
| region='us-east-1' | |
| profile='' | |
| ################################################################################ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| #!/bin/bash | |
| # install packages/dependencies for compilation | |
| sudo yum -y install gcc make ncurses-devel | |
| cd /tmp | |
| # the latest version of ncdu is published here: http://dev.yorhel.nl/ncdu | |
| # update the link below if necessary: | |
| wget -nv http://dev.yorhel.nl/download/ncdu-1.10.tar.gz |