Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

abdennour abdennour

🌴
On vacation
View GitHub Profile
@abdennour
abdennour / calculate-dynamodb-read-throughput.js
Last active Jul 7, 2017
Calculate required read throughput for AWS DynamoDB
View calculate-dynamodb-read-throughput.js
/**
* [calculate description]
* @method calculate
* @param {Number} itemsCount number of items to be read
* @param {Number} itemsRequiredTimeRead required time in seconds to read those items
* @param {Number} itemSize the size of each item in KB
* @param {Boolean} isStrongRead the consistency model of Read : Strong or eventual
* @return {Number} Read throughput
*/
function calculate({itemsCount, itemsRequiredTimeRead, itemSize}, isStrongRead = true) {
@abdennour
abdennour / main.sh
Created Jul 29, 2017
Upgrade to React 15+
View main.sh
npm install --save prop-types;
npm update react react-dom enzyme;
@abdennour
abdennour / mufa-vs-redux.md
Last active Aug 5, 2017
Sub/Pub pattern implementation between Mufa & Redux
View mufa-vs-redux.md
Mufa Redux
Publish fire or pub dispatch
Subscribe on or sub subscribe
Unsubscribe off(subscribe_return) subscribe_return()
Event String identifies the event Literal object that must has type property which identifies the event (action)
Message Argument for each message fire(event_name, msg1,..., msgn) Property for each message in the action {type: event_name, msg1, msg2,... msgn}
NPM npm install mufa npm install redux
@abdennour
abdennour / cat-role.sh
Last active Dec 9, 2017
Display AMI role metedata associated to the running EC2 : access key, secret access key, token, last rotation, .. so on.
View cat-role.sh
#!/bin/bash
ENDPOINT=http://169.254.169.254/latest/meta-data/iam/security-credentials/;
curl -s $ENDPOINT`curl -s $ENDPOINT`
@abdennour
abdennour / 01-lambda-exec-role.yaml
Last active Dec 20, 2017
Calculator of DynamoDB reserved capacity via CloudFormation
View 01-lambda-exec-role.yaml
# Should be deployed first as it exports "LambdaRoleExecutionARN" which is used by other stacks.
Resources:
LambdaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: Allow
@abdennour
abdennour / open-python-jupyter-notebook.sh
Created Feb 17, 2018
Open Python Jupyter Notebook ( jupyter is a prerequisite )
View open-python-jupyter-notebook.sh
#!/bin/bash
WS=/tmp/complete-python-bootcamp-notebook-udemy;
if [[ ! -d "$WS" ]]; then
git clone git@github.com:rathath-it/Complete-Python-Bootcamp.git $WS;
fi
cd $WS;
jupyter notebook;
@abdennour
abdennour / README-Template.md
Created Feb 20, 2018 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@abdennour
abdennour / vagrant-destory_all.sh
Created Mar 8, 2018
Destroy all running Vagrant boxes after Confirmation
View vagrant-destory_all.sh
#!/bin/bash
for i in `vagrant global-status | grep virtualbox | awk '{ print $1 }'` ; do vagrant destroy $i ; done
@abdennour
abdennour / install_aws_zsh_complete.sh
Last active Mar 8, 2018
Install AWS Auto Completer for ZSH
View install_aws_zsh_complete.sh
#!/bin/bash
# Retrieve the version of AWS
AWS_VERSION=$(aws --version | cut -f1 -d" " | cut -f2 -d"/");
echo Your current AWS version is $AWS_VERSION;
REMOTE_PATH=https://raw.githubusercontent.com/aws/aws-cli/$AWS_VERSION/bin/aws_zsh_completer.sh
LOCAL_PATH=/usr/local/bin/aws_zsh_completer.sh;
@abdennour
abdennour / README.md
Last active Mar 20, 2018
Automate Snapshot creation of EBS attached to running instances in certain region
View README.md

Overview

According to the specified region, the script will search on all running instances, then it extracts the volumes ids attached to those EBS volumes, then it takes a snapshot for each volume with a consistent tagging approach.

Pre-requistes

How to use