Skip to content

Instantly share code, notes, and snippets.

View evansmwendwa's full-sized avatar
🎵
Not stopping

Evans Mwendwa evansmwendwa

🎵
Not stopping
View GitHub Profile

DEPLOYING DJANGO APPLICATION TO UBUNTU SERVER

KMD CASE - DEPLOYED IN FORGE

Warning! Intermediate experience in setting up Nginx and Python in ubuntu is required to follow this setup

This setup uses Python version 2.7.x and Ubuntu 16 setup with a non root sudo account.

This Tutorial follows the article provided by digital ocean https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 and the setup is done in a digital ocean droplet provisioned by Laravel forge. Forge's sites feature and SSL feature is used instead of manual nginx server blocks.

Install the Packages from the Ubuntu Repositories

Setting up Localhost Nginx Reverse Proxy to react app

This helps you develop react apps through a sub domain secured by ssl through nginx without much hassle. Current config from Laragon on Windows

server {
    listen 80;
    listen 443 ssl;

Setup PHP for Local and Production (Ubuntu 20.04 LTS)

Add PHP PPA Repository

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
#!/bin/bash
# A bash script to remove old versions of a Google App Engine instance.
#
# Inspiration of script taken from:
# https://almcc.me/blog/2017/05/04/removing-older-versions-on-google-app-engine/
# Original code by Alastair McClelland and Marty Číž.
# Assembled and modified by Johan Niklasson.
#
# To run this script, execute
version: "3.5"
services:
postgres:
container_name: docker-postgres
image: postgres:9.6
ports:
- "5432:5432"
environment:
POSTGRES_DB: "kong"

Wanted to report back on some research and success enabling middle click action.

deepin doesn’t use libinput-gestures nor gesture-manager, although this is probably the correct answer on vanilla arch.

Deepin uses a built in touchpad solution controlled by dde-daemon. All touchpad gestures are controlled by the file /usr/share/dde-daemon/gesture.json. To enable middle click via 3-finger tap, add the following entry in the json array:

   {
        "Name": "tap",
        "Direction": "none",
 "Fingers": 3,

Creating a MySql Super user

CREATE USER 'dev'@'localhost' IDENTIFIED BY 'secret';

GRANT ALL PRIVILEGES ON *.* TO 'dev'@'localhost' WITH GRANT OPTION;

CREATE USER 'dev'@'%' IDENTIFIED BY 'secret';

GRANT ALL PRIVILEGES ON *.* TO 'dev'@'%' WITH GRANT OPTION;
{"lastUpload":"2019-12-18T16:34:36.775Z","extensionVersion":"v3.4.3"}

Docker installation on Ubuntu

Uninstall old versions

sudo apt-get remove docker docker-engine docker.io

Update the apt package index:

sudo apt-get update
---
METHOD 1
This should roughly sort the items on distance in MySQL, and should work in SQLite.
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance.
---
SELECT *
FROM table
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC