This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import transaction | |
def manual_rollback(): | |
"""Create and rollback using manual transaction calls""" | |
transaction.enter_transaction_management() | |
transaction.managed() | |
try: | |
try: | |
create() | |
error() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import newrelic.agent | |
try: | |
# ... | |
# some code | |
# ... | |
except Exception as e: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch --merged origin/master | grep -v '\* master' | xargs -l1 git branch -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This hook is run after every virtualenv is activated. | |
envname="$(basename $VIRTUAL_ENV)" | |
if [ -e ".env" ] | |
then | |
source .env | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.contrib.admin import SimpleListFilter | |
from django.utils.translation import ugettext_lazy as _ | |
from object_images.models import ObjectImage | |
class ObjectImagesListFilter(SimpleListFilter): | |
title = _("object images") | |
parameter_name = "images" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* If you don’t care about the results of a task, be sure to set the ignore_result option, as storing results wastes time and resources: | |
@celery.task(ignore_result=True) | |
def mytask(...) | |
something() | |
Results can even be disabled globally using the CELERY_IGNORE_RESULT setting. | |
* Or instead of routing it you could rate limit the task instead, so that only 10 tasks of this type can be processed in a minute (10/m): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Spanish | |
Portuguese | |
English | |
Norwegian | |
Hungarian | |
Danish | |
Finish | |
French | |
Italian | |
Dutch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name www.sarasa.com sarasa.com; | |
if ($host != 'sarasa.com' ) { | |
rewrite ^/(.*)$ http://sarasa.com/$1 permanent; | |
} | |
# Serve an empty 1x1 gif _OR_ an error 204 (No Content) for favicon.ico | |
location = /favicon.ico { | |
empty_gif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{rabbit, [ | |
{auth_backends, [rabbit_auth_backend_internal]}, | |
{auth_mechanisms, ['PLAIN','AMQPLAIN']}, | |
{backing_queue_module, rabbit_variable_queue}, | |
{cluster_nodes, []}, | |
{collect_statistics, coarse}, | |
{collect_statistics_interval, 5000}, | |
{default_permissions, [<<".*">>,<<".*">>,<<".*">>]}, | |
{default_user, <<"guest">>}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<opml version="1.1"> | |
<head> | |
<title>Planet Django</title> | |
<dateModified>Sat, 08 Mar 2014 20:57:35 +0000</dateModified> | |
<ownerName>Adomas Paltanavičius</ownerName> | |
<ownerEmail>[email protected]</ownerEmail> | |
</head> | |
<body> |