Fix ubuntu 16.04 macbook brightness issue after lid close

Note: All tests are being done on 2013 macbook air

Ubuntu on MacBook almost works perfectly like any other laptops out there. There are some issues though. One the most annoying one is the brightness issue. Once the lid is closed, it goes to sleep state. After waking up, only 2 options for the brightness 0 or 100.

To solve the issue we need to install mba6x_bl

Follow the following steps

╰─○ git clone git://github.com/patjak/mba6x_bl 
╰─○ cd mba6x_bl 
╰─○ make
╰─○ checkinstall
╰─○ sudo dpkg -i mba6x-bl_xxxxxx_amd64.deb (check your folder for the exact name of deb file generated from check install)
╰─○ sudo depmod -a 
╰─○ sudo modprobe mba6x_bl 
╰─○ sudo reboot

That’s it folks. You have successfully squashed the bug

Enjoy smile

Serving Flask helloworld using uwsgi

uwsgi is a high performance, low-resource usage web server for deploying python application.

In this post, i am going to show how to serve a simple HelloWorld application in flask using uwsgi

 

Prerequisites

pip install flask 

pip install uwsgi

Now lets create our app.py

from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    app.run()


So we have created a simple flask application. Now lets create a run file for running the application

run.py

from app import app as application
if __name__ == "__main__":
    application.run()


Now we need to create a .ini (uwsgi.ini) file to save the settings for serving the uwsgi

[uwsgi]
http = 127.0.0.1:3031
chdir = /home/name/flaskuwsgi
wsgi-file = run.py
processes = 4
threads = 2
stats = 127.0.0.1:9191

now serve the application by running uwsgi uwsgi.ini. You can view your application at 127.0.0.1:3031

if you wish to serve it via nginx, configure reverse proxy to the ip and port after changing the first line in uwsgi.ini to

socket = 127.0.0.1:3031

Njoy smile