Skip to content

Instantly share code, notes, and snippets.

View tupy's full-sized avatar

Osvaldo Matos-Junior tupy

View GitHub Profile
@mywaiting
mywaiting / graceful_shutdown_tornado_web_server.py
Last active May 7, 2022 08:30
The example to how to shutdown tornado web server gracefully...
#!/usr/bin/env python
"""
How to use it:
1. Just `kill -2 PROCESS_ID` or `kill -15 PROCESS_ID` , The Tornado Web Server Will shutdown after process all the request.
2. When you run it behind Nginx, it can graceful reboot your production server.
3. Nice Print in http://weibo.com/1682780325/zgkb7g8k7
"""
@lepture
lepture / gevent-flask.py
Last active January 30, 2020 15:29
gevent with werkzeug reload and debug
def runserver(port=5000, profile_log=None):
"""Runs a development server."""
from gevent.wsgi import WSGIServer
from werkzeug.serving import run_with_reloader
from werkzeug.debug import DebuggedApplication
from werkzeug.contrib.profiler import ProfilerMiddleware
port = int(port)
if profile_log:
@dergachev
dergachev / README.md
Created October 10, 2012 16:49
Vagrant tutorial

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@tupy
tupy / gist:3693808
Created September 10, 2012 20:58 — forked from dlutzy/gist:2469037
Multi VM Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# David Lutz's Multi VM Vagrantfile
# inspired from Mark Barger's https://gist.github.com/2404910
boxes = [
{ :name => :web, :role => 'web_dev', :ip => '192.168.33.1', :ssh_port => 2201, :http_fwd => 9980, :cpus =>4, :shares => true },
{ :name => :data, :role => 'data_dev', :ip => '192.168.33.2', :ssh_port => 2202, :mysql_fwd => 9936, :cpus =>4 },
{ :name => :railsapp, :role => 'railsapp_dev', :ip => '192.168.33.3', :ssh_port => 2203, :http_fwd => 9990, :cpus =>1}
]
@flores
flores / gist:1623381
Created January 16, 2012 22:28
sample haproxy.cfg
global
log 127.0.0.1 local0 notice
maxconn 50000
daemon
stats socket /tmp/proxystats level admin
defaults
log global
mode http
option httplog
option dontlognull
@jonashaag
jonashaag / 0-howto-listfield-django-admin.rst
Created September 7, 2011 09:41
Howto use ListFields in Django's admin

Howto use ListFields in Django's admin

Problem

Consider this blog post model:

models.py

:

@groner
groner / terrain.py
Created August 10, 2010 13:11
Hooks for lettuce to run a test pylons server
'''Hooks for lettuce to run a test pylons server'''
import threading
from os import getcwd
import pylons.test
from paste.deploy.loadwsgi import loadapp
from paste.httpserver import serve
from paste.script.appinstall import SetupCommand