Skip to content

Instantly share code, notes, and snippets.

View Lh4cKg's full-sized avatar
🐍
Working

Lasha Gogua Lh4cKg

🐍
Working
View GitHub Profile

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:

#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name

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:

#! /usr/bin/env python
import fileinput
import argparse
from operator import itemgetter
parser = argparse.ArgumentParser()
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int)
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+')
args = parser.parse_args()
@Lh4cKg
Lh4cKg / Python Proxy Tester
Created October 10, 2015 07:56 — forked from eye9poob/Python Proxy Tester
Python Proxy Tester
import requests
nList= []
nProxL = ''
file = open('proxy.txt')
for line in file:
try:
aproxy = line.strip('\n')
user_agent = {'User-agent': 'Mozilla/5.0'}
print aproxy
proxies = {
@Lh4cKg
Lh4cKg / sqlite2pg.sh
Created November 11, 2015 12:32 — forked from eclubb/sqlite2pg.sh
Script to import SQLite3 database into PostgreSQL
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3
#!/bin/bash
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
#
# See also:
# - http://stackoverflow.com/questions/4581727/convert-sqlite-sql-dump-file-to-postgresql
# - https://gist.github.com/bittner/7368128
@Lh4cKg
Lh4cKg / task_update_json.html
Created November 15, 2015 20:13 — forked from goldhand/task_update_json.html
Updates any Task model without reloading using ajax
#views.py
class TaskUpdateView(generic.UpdateView):
model = Task
form_class = TaskForm
@json_view
def dispatch(self, *args, **kwargs):
return super(TaskUpdateView, self).dispatch(*args, **kwargs)
@Lh4cKg
Lh4cKg / migrator.sh
Created November 19, 2015 16:59 — forked from vigneshwaranr/migrator.sh
Script to convert SQLITE dumps into PostgreSQL compatible dumps
#! /bin/sh
usage_error () {
echo 'Usage: sh migrator.sh <path to sqlite_to_postgres.py> <path to sqlite db file> <an empty dir to output dump files>'
echo
echo 'Example:'
echo '>sh migrator.sh sqlite_to_postgres.py ~/reviewboard.db /tmp/dumps'
echo
echo 'Tested on:'
echo 'Python 2.7.3'
@Lh4cKg
Lh4cKg / spin.py
Created January 20, 2016 19:02 — forked from arindampradhan/spin.py
Spinners for python | python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import signal
from os import system
### MENU ###
# Here are all the elements you can import
# Box elements