Skip to content

Instantly share code, notes, and snippets.

View sharifanani's full-sized avatar

Sharif Anani sharifanani

  • Duo Security
  • Ann Arbor, MI, USA
View GitHub Profile
@sharifanani
sharifanani / gist:ac0c4279985f17bbe171eabdd5f7bc19
Created May 14, 2018 04:45 — 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:

@sharifanani
sharifanani / migrate-django.md
Created August 27, 2018 05:54 — forked from sirodoht/migrate-django.md
How to migrate Django from SQLite to PostgreSQL

How to migrate Django from SQLite to PostgreSQL

Dump existing data:

python3 manage.py dumpdata > datadump.json

Change settings.py to Postgres backend.

Make sure you can connect on PostgreSQL. Then:

@sharifanani
sharifanani / validators.py
Created August 29, 2018 06:18 — forked from jrosebr1/validators.py
Validator for files, checking the size, extension and mimetype for Django.
# @brief
# Performs file upload validation for django. The original version implemented
# by dokterbob had some problems with determining the correct mimetype and
# determining the size of the file uploaded (at least within my Django application
# that is).
# @author dokterbob
# @author jrosebr1
import mimetypes
@sharifanani
sharifanani / CouchDB_Python.md
Created September 13, 2018 02:21 — forked from marians/CouchDB_Python.md
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@sharifanani
sharifanani / client.py
Created May 17, 2019 06:20 — forked from ninedraft/README.md
Python udp broadcast client server example
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # UDP
client.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
client.bind(("", 37020))
while True:
data, addr = client.recvfrom(1024)
print("received message: %s"%data)
@sharifanani
sharifanani / daemon.json
Created May 29, 2020 04:36
Example Docker daemon.json
{
"api-cors-header": "",
"authorization-plugins": [],
"bip": "",
"bridge": "",
"cgroup-parent": "",
"cluster-store": "",
"cluster-store-opts": {},
"cluster-advertise": "",
"debug": true,