Skip to content

Instantly share code, notes, and snippets.

View arthuralvim's full-sized avatar

Arthur Alvim arthuralvim

View GitHub Profile
@FlaviuSim
FlaviuSim / gist:2510028
Created April 27, 2012 15:09
supervisor
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
@juliosmelo
juliosmelo / fabfile.py
Created May 23, 2012 03:10
Fabric file for deploy django+gunicorn+nginx+virutalenv
import sys
from fabric.colors import green, yellow
from fabric.contrib.console import confirm
from fabric.context_managers import cd, prefix
from fabric.operations import prompt
from fabric.api import run, local, env, sudo
env.user = 'ubuntu'
env.hosts = ['0.0.0.0'] #ip do ec2
env.app_path = '/home/seu-usuario-do-ec2/bomgusto'
@samliu
samliu / scrapy.py
Created June 22, 2012 23:11
manage command for django to call scrapy
# Enable us to call scrapy from manage.py
from __future__ import absolute_import
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def run_from_argv(self, argv):
self._argv = argv
self.execute()
@Couto
Couto / SublimeLinter.sublime-settings
Created July 29, 2012 16:23
SublimeLinter configuration
/*
SublimeLinter default settings
*/
{
/*
Sets the mode in which SublimeLinter runs:
true - Linting occurs in the background as you type (the default).
false - Linting only occurs when you initiate it.
"load-save" - Linting occurs only when a file is loaded and saved.
@beniwohli
beniwohli / views.py
Created October 4, 2012 13:10
extension of django.views.generic.ListView for sorted lists
# -*- coding: utf-8 -*-
from django.views.generic import ListView
class SortableListView(ListView):
allowed_sort_fields = ()
sort_default = None
sort_key = 'sort'
sort_field_splitter = '-'
sort_ascending_postfix = 'up'
sort_descending_postfix = 'down'
@marcelcaraciolo
marcelcaraciolo / asciize.py
Created October 18, 2012 05:20
Removedor de Acentos
d = {192: u'A', 193: u'A', 194: u'A', 195: u'A', 196: u'A', 197: u'A',
199: u'C', 200: u'E', 201: u'E', 202: u'E', 203: u'E', 204: u'I',
205: u'I', 206: u'I', 207: u'I', 209: u'N', 210: u'O', 211: u'O',
212: u'O', 213: u'O', 214: u'O', 216: u'O', 217: u'U', 218: u'U',
219: u'U', 220: u'U', 221: u'Y', 224: u'a', 225: u'a', 226: u'a',
227: u'a', 228: u'a', 229: u'a', 231: u'c', 232: u'e', 233: u'e',
234: u'e', 235: u'e', 236: u'i', 237: u'i', 238: u'i', 239: u'i',
241: u'n', 242: u'o', 243: u'o', 244: u'o', 245: u'o', 246: u'o',
248: u'o', 249: u'u', 250: u'u', 251: u'u', 252: u'u', 253: u'y',
/*
* A rather simple way of testing out SwampDragon.
* Create a load of connections, connect, subscriber, update and count the number
* of published messages.
*
* SETUP:
* 1. npm install sockjs-client-node
* 2. curl https://raw.githubusercontent.com/jonashagstedt/swampdragon/master/swampdragon/static/swampdragon/js/swampdragon.js > swampdragon.js
* 3. Set router_name to the name of your router.
* 4. Change "sd.update_object(router_name, { value: val }, 'foo');" to call
@jniltinho
jniltinho / send_mail.py
Last active November 23, 2015 15:52
Send Mail plugin for Nagios
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Script Send Mail Nagios (send_mail.py)
Copyrighted by Nilton OS <jniltinho at gmail.com>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Version: 0.1
Put this script in Nagios plugins folder
anonymous
anonymous / gist:c3bdbd8402f318c70694
Created November 24, 2015 18:20
def test_login_page(self):
"""
Test Login Page
"""
response = self.client.get(reverse("login"))
self.assertEqual(response.status_code, 200)
# Usuário não existe
response = self.client.post(reverse("login"), {'username': 'unknown', 'password': 'doesnotexist'})
@archiechen
archiechen / gist:4335764
Created December 19, 2012 10:22
使用backbone重构拖拽效果。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->