Skip to content

Instantly share code, notes, and snippets.

View akkefa's full-sized avatar
💻
Grit

Ikram Ali akkefa

💻
Grit
View GitHub Profile
version: '3.3'
services:
app:
container_name: "test_app"
build:
context: ./
dockerfile: ./docker/python/Dockerfile
volumes:
from functools import wraps
from flask import session, request, redirect, url_for
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get("username") is None:
return redirect(url_for("user_app.login", next=request.url))
return f(*args, **kwargs)
@akkefa
akkefa / Docker-compose V 3.3 Django setup
Last active January 24, 2019 17:21
Docker-compose V3.3 Django mysql nginx Setup
version: '3.3'
services:
django:
container_name: "django"
build:
context: ./docker/django
working_dir: /var/www
command: ["gunicorn", "-b", "0.0.0.0:8000" ,"-w" ,"4" ,"djangoapps.wsgi"]
version: '3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
# To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
# To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
from skimage import io
from skimage.color import rgb2gray
from skimage.transform import resize, rotate
arr = resize(io.imread('black.jpg'),(32,32))
arr = rgb2gray(arr)
Using familiar syntax, you can view the contents of your S3 buckets in a directory-based listing.
$ aws s3 ls s3://mybucket
LastWriteTime Length Name
------------- ------ ----
PRE myfolder/
2013-09-03 10:00:00 1234 myfile.txt
...
You can perform recursive uploads and downloads of multiple files in a single folder-level command. The AWS CLI will run these transfers in parallel for increased performance.
@akkefa
akkefa / gist:8b974ac297f6fa61538179971bced0c8
Created April 12, 2017 02:42 — forked from evildmp/gist:3094281
Set up Django, nginx and uwsgi

This document has now been incorporated into the uWSGI documentation:

http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

Set up Django, nginx and uwsgi

Steps with explanations to set up a server using: