Skip to content

Instantly share code, notes, and snippets.

View abdennour's full-sized avatar
🌴
On vacation

abdennour abdennour

🌴
On vacation
View GitHub Profile
@abdennour
abdennour / calculate-dynamodb-read-throughput.js
Last active July 7, 2017 19:26
Calculate required read throughput for AWS DynamoDB
/**
* [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 July 29, 2017 09:19
Upgrade to React 15+
npm install --save prop-types;
npm update react react-dom enzyme;
@abdennour
abdennour / mufa-vs-redux.md
Last active August 5, 2017 14:18
Sub/Pub pattern implementation between Mufa & Redux
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 December 9, 2017 07:03
Display AMI role metedata associated to the running EC2 : access key, secret access key, token, last rotation, .. so on.
#!/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 December 20, 2017 17:33
Calculator of DynamoDB reserved capacity via CloudFormation
# 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 February 17, 2018 05:38
Open Python Jupyter Notebook ( jupyter is a prerequisite )
#!/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 February 20, 2018 02:13 — forked from PurpleBooth/README-Template.md
A template to make good README.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 March 8, 2018 02:06
Destroy all running Vagrant boxes after Confirmation
#!/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 March 8, 2018 07:08
Install AWS Auto Completer for ZSH
#!/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 March 20, 2018 06:43
Automate Snapshot creation of EBS attached to running instances in certain region

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