Steps with explanations to set up a server using:
- Virtualenv
- Virtualenvwrapper
- Django
- Gunicorn
| upstream uwsgi { | |
| ip_hash; | |
| server 127.0.0.1:40000; | |
| } | |
| server { | |
| listen 80; | |
| server_name www.domain.com; | |
| root /sites/mysite/; | |
| access_log /sites/mysite/log/nginx/access.log; |
| # -*- coding: utf-8 -*- | |
| from django.conf import settings | |
| from django.core.files.storage import FileSystemStorage | |
| from django.db import models | |
| class OverwriteStorage(FileSystemStorage): | |
| ''' | |
| Muda o comportamento padrão do Django e o faz sobrescrever arquivos de | |
| mesmo nome que foram carregados pelo usuário ao invés de renomeá-los. | |
| ''' |
| FILE SPACING: | |
| # double space a file | |
| sed G | |
| # double space a file which already has blank lines in it. Output file | |
| # should contain no more than one blank line between lines of text. | |
| sed '/^$/d;G' |
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| { | |
| "libs": [ | |
| "browser", | |
| "underscore", | |
| "jquery" | |
| ], | |
| "plugins": { | |
| "node": {} | |
| } | |
| } |
| #!/bin/sh | |
| # @source: https://gist.github.com/ronanguilloux/11f6a788358577474ab4 | |
| # @link http://tech.zumba.com/2014/04/14/control-code-quality/ | |
| PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"` | |
| STAGED_FILES_CMD=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php` | |
| # Determine if a file list is passed |
| # Assume we are in your home directory | |
| cd ~/ | |
| # Clone the repo from GitLab using the `--mirror` option | |
| $ git clone --mirror [email protected]:mario/my-repo.git | |
| # Change into newly created repo directory | |
| $ cd ~/my-repo.git | |
| # Push to GitHub using the `--mirror` option. The `--no-verify` option skips any hooks. |
| /** | |
| * Depth-first and Breadth-first graph traversals. | |
| * | |
| * In this diff we implement non-recursive algorithms for DFS, | |
| * and BFS maintaining an explicit stack and a queue. | |
| * | |
| * by Dmitry Soshnikov <[email protected]> | |
| * MIT Style license | |
| */ |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm