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 / README.md
Created July 6, 2018 18:14
Notify GOOOAL with Google World Cup 2018

Open Google

https://google.com

Search by name of teams

  • Example: Brazil vs Belgiun

Open JS console of browser

@abdennour
abdennour / connect.js
Last active July 24, 2018 15:24
Array instead of mapStateToProps function in React-Redux connect
import { connect } from 'react-redux';
import _ from 'lodash';
export default function(...args) {
return function(ComponentClass) {
const mapStateToProps = !Array.isArray(args[0])
? args[0]
: state => _.pick(state, args[0]);
return connect(mapStateToProps, mapDispatchToProps)(ComponentClass);
};
@abdennour
abdennour / ec2-aws-keys2-container.sh
Created October 11, 2018 08:52
pass ec2 role keys to container.sh
# install dependencies
apt-get install jq -y
# Set Variables
DOCKER_IMAGE=python:alpine
ENDPOINT=http://169.254.169.254/latest/meta-data/iam/security-credentials/
KEYS=$(curl -s $ENDPOINT`curl -s $ENDPOINT`)
docker run -it --rm \
@abdennour
abdennour / ssh-docker-vm.sh
Created November 30, 2018 05:28
ssh-docker-for-mac
#!/bin/bash
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
@abdennour
abdennour / 01-install_prerequisites.sh
Last active December 15, 2018 03:33
Bitbucket Full Backup of GIT Repositories
#!/bin/bash
pip install oauthlib
pip install https://github.com/samkuehn/bitbucket-backup/archive/master.zip
# -*- mode: ruby -*-
# vi: set ft=ruby :
servers = [
{
:name => "k8s-head",
:type => "master",
:box => "ubuntu/xenial64",
:box_version => "20180831.0.0",
:eth1 => "192.168.205.10",
@abdennour
abdennour / export-ec2-to-ova.sh
Created February 26, 2019 03:24
Export AWS EC2 instance to a standard VM file format - ova, ovf, vmdk
#!/bin/bash
# Export EC2 to OVA and save OVA in S3 bucket s3://export-vms/ubuntus/18-04/*.ova
aws ec2 create-instance-export-task \
--instance-id i-0c006d5b801050318 \
--target-environment vmware \
--export-to-s3-task DiskImageFormat=VMDK,ContainerFormat=ova,S3Bucket=export-vms,S3Prefix=ubuntus/18-04/
@abdennour
abdennour / install-certificate.sh
Created April 6, 2019 20:22
Install Certificate for Many clients
#!/bin/bash
# Usage: $0 java google.com 443
CLIENT=$1
HOST=$2
PORT=$3
# openssl s_client -servername $HOST -connect $HOST:$PORT </dev/null 2>/dev/null | openssl x509 -inform PEM -outform DER -out ${HOST}.cer
@abdennour
abdennour / users.yml
Created April 26, 2019 20:05
playbook example
View the file *http://files.example.com/user_list.yml* from *control1*. Create a playbook in */home/ansible/exam/users.yml* that follows the instructions provided in the file.
Create the file /home/ansible/exam/users.yml containing the following:
---
- hosts: localhost
tasks:
- name: download user_list.yml
get_url:
url: http://files.example.com/user_list.yml
---
- hosts: localhost
tasks:
- name: download user_list.yml
get_url:
url: http://files.example.com/user_list.yml
dest: /home/ansible/files/user_list.yml
- hosts: node1