Skip to content

Instantly share code, notes, and snippets.

View eon01's full-sized avatar
🎯
Focusing

Aymen EL Amri eon01

🎯
Focusing
View GitHub Profile
@eon01
eon01 / auto sync S3 bucket on file change
Last active February 14, 2019 20:44
This gist helps you to auto synchronize a local folder with an S3 bucket as soon as 1 or more files in the folder change. Helpful for live debugging when developping.
1) Install inotifywait
sudo apt install inotifywait
2) Use inotifywait to sync your folders to S3
s3folder = "<your_s3_fodler_path>"
s3bucket = "s3://<your_s3_bucket_name>"
while inotifywait $s3folder; do aws s3 sync $s3folder $s3bucket --delete; done
@eon01
eon01 / install virtualenv ubuntu 16.04.md
Created July 31, 2018 20:55 — forked from Geoyi/install virtualenv ubuntu 16.04.md
How to install virtual environment on ubuntu 16.04

How to install virtualenv:

Install pip first

sudo apt-get install python3-pip

Then install virtualenv using pip3

sudo pip3 install virtualenv 
@eon01
eon01 / httrack mirroring with near flag
Created August 5, 2017 18:15
httrack mirroring with near flag
# near: get non-html files 'near' an html file (ex: an image located outside) (--near)
httrack --near -%v -z -%k -%B -B -u2 -%u -O ./. 'http://blog.eon01.com'
@eon01
eon01 / php7-fpm + nginx
Created July 6, 2017 21:31
Nginx configuration with php7-fpm
server {
listen 8000 default_server;
listen [::]:8000 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
@eon01
eon01 / docker-destroy-all.sh
Last active June 7, 2017 15:44 — forked from JeffBelback/docker-destroy-all.sh
Destroy all Docker Containers and Images
#!/bin/bash
# Destroy everything
# https://www.youtube.com/watch?v=DBwgX8yBqsw
#
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@eon01
eon01 / js_redirect_android_ios.js
Last active June 7, 2017 14:38
Redirect static website according to the User Agent (Android, iOS)
<script type="text/javascript">
var u = navigator.userAgent
if( /iPhone/i.test(u) ) {
//window.location = "http://www.apple.com";
}
else if (/android/i.test(u)) {
//window.location = "http://www.google.com";
}
</script>
@eon01
eon01 / Install_React_Native_Android_on_Ubuntu.md
Last active December 19, 2022 10:58 — forked from ShirajG/Install_React_Native_Android_on_Ubuntu.md
Steps for getting a working Linux install for React Native Android

Installing React Native Android on Ubuntu

Here are the steps for getting a working Linux install for React Native:

  1. Install Java SDK
  1. Install KVM
    • sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager
    • sudo adduser $USER libvirtd
@eon01
eon01 / github_flask_oauth2.py
Created April 5, 2017 20:55 — forked from ib-lundgren/github_flask_oauth2.py
Example of how to use Flask with requests-oauthlib to fetch a GitHub user profile using an OAuth 2 token.
from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
import os
app = Flask(__name__)
# This information is obtained upon registration of a new GitHub
client_id = "<your client key>"
@eon01
eon01 / Wordpress + Docker Swarm + Docker Compose V3 + RDS
Created March 18, 2017 23:51
Wordpress + Docker Swarm + Docker Compose V3 + RDS
version: '3'
networks:
wordpress_network:
#volumes:
# fs-xxxxx:
# driver: rexray or efs
# driver_opts:
# share: "fs-xxxxx"
@eon01
eon01 / gist:9bb0ad98fbfc2e9cf53df1c363078465
Created March 14, 2017 22:14
Installing MariaDB for OpenStack (Clone from: OpenStack Cloud Computing Cookbook)
#!/bin/bash
# controller.sh
# Authors: Kevin Jackson ([email protected])
# Cody Bunch ([email protected])
# Egle Sigler ([email protected])
# Vagrant scripts used by the OpenStack Cloud Computing Cookbook, 3rd Edition
# Website: http://www.openstackcookbook.com/