Skip to content

Instantly share code, notes, and snippets.

View felipe-prenholato's full-sized avatar

Felipe Prenholato felipe-prenholato

View GitHub Profile
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.http import HttpResponseRedirect
from django.utils.http import urlquote
from django.utils.decorators import available_attrs
from functools import wraps
import time
import logging
from lockfile import FileLock, AlreadyLocked, LockTimeout
felipe@felipe-G51JX:/media/Media/Fotos/CameraSony$ du -sh 101MSDCF
2.0G 101MSDCF
felipe@felipe-G51JX:/media/Media/Fotos/CameraSony$ ls 101MSDCF/*JPG -1 | wc -l
489
felipe@felipe-G51JX:/media/Media/Fotos/CameraSony$ time cp 101MSDCF/* 101MSDCF_redimencionadas/
real 1m12.071s
user 0m0.060s
sys 0m5.012s
felipe@felipe-G51JX:/media/Media/Fotos/CameraSony$ time ppss -d 101MSDCF/ -c "cp $ITEM 101MSDCF_redimencionadas/"
#! /bin/sh
# /etc/init.d/portal_prd
### BEGIN INIT INFO
# Provides: portal
# Required-Start: $nginx
# Required-Stop:
# Default-Start: 1
# Default-Stop:
# Short-Description: start uwsgi server sistemas.pdg.com.br:80
### END INIT INFO
root@PLAPSTMD142:/var/www/gitorious# bundle exec rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
You have not yet defined a destination named push_event. Destinations currently defined are [merge_request_backend_updates,destroy_repo,merge_request_version_deletion,push,ssh_key_generation,web_hook_notifications,archive_repo,cc_message,mirror_merge_request,create_repo]
/var/www/gitorious/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:272:in `find_destination'
/var/www/gitorious/vendor/plugins/activemessaging/lib/activemessaging/gateway.rb:282:in `subscribe_to'
/var/www/gitorious/vendor/plugins/activemessaging/lib/activemessaging/processor.rb:11:in `subscribes_to'
/var/www/gitorious/app/processors/push_event_processor.rb:22
class URLHist(Model):
url = models.TextField()
hostname = models.CharField(max_length=250)
hostname_type = models.CharField(max_length=1,choices=(('I','Interno'),('E','Externo')))
last_status = models.IntegerField() # a html status code
class Meta:
verbose_name = u'Histórico de URL'
verbose_name_plural = u'Histórico de URLs'
==> /var/log/nginx/error.log <==
2011/11/09 01:15:41 [error] 8448#0: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.22.1.67, server: sistemas.pdg.com.br, request: "POST /rh/colaborador/ HTTP/1.1", upstream: "uwsgi://unix:///home/sistemas/virtualenvs/prd/tmp/uwsgi.sock:", host: "192.168.4.74", referrer: "http://192.168.4.74/rh/colaborador/"
==> /var/log/nginx/access.log <==
172.22.1.67 - - [09/Nov/2011:01:15:41 -0200] "POST /rh/colaborador/ HTTP/1.1" 504 584 "http://192.168.4.74/rh/colaborador/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2"
==> /home/sistemas/virtualenvs/prd/logs/uwsgi.log <==
Wed Nov 9 01:15:45 2011 - writev(): Broken pipe [plugins/python/wsgi_headers.c line 206]
Wed Nov 9 01:15:45 2011 - write(): Broken pipe [plugins/python/wsgi_subhandler.c line 235]
[pid: 8465|app: 0|req: 1/1] 172.22.1.67 () {50 vars in 1047 bytes} [Wed Nov 9 01:14:40 2011] POST /rh/colaborador/ => ge
server {
listen 80;
server_name sistemas.pdg.com.br;
root /home/sistemas/virtualenvs/prd/portal;
location /media/ {
root /home/sistemas/virtualenvs/prd/portal;
expires max;
}
execve("/opt/usr/bin/transmission-daemon", ["transmission-daemon", "--log-debug", "--log-error", "--log-info", "-f"], [/* 12 vars */]) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x2aaaf000
stat("/etc/ld.so.cache", {st_mode=S_IFREG|0644, st_size=64, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY|0x80000) = 3
old_mmap(NULL, 64, PROT_READ, MAP_SHARED, 3, 0) = 0x2aab0000
close(3) = 0
open("/opt/lib/libevent-2.0.so.5", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/opt/usr/lib/libevent-2.0.so.5", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0755, st_size=248032, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000, -1, 0) = 0x2aab1000
class ExTestCase(TestCase):
def assertRaisesMessage(self, expected_exception, expected_message,
callable_obj=None, *args, **kwargs):
"""
Asserts that the message in a raised exception matches the passed
value.
Args:
expected_exception: Exception class expected to be raised.
expected_message: expected error message string value.
@felipe-prenholato
felipe-prenholato / logging_mocker.py
Created October 6, 2011 04:14
Mock Logging Handler
class MockLoggingHandler(logging.Handler):
"""Mock logging handler to check for expected logs."""
def __init__(self, *args, **kwargs):
self.reset()
logging.Handler.__init__(self, *args, **kwargs)
def emit(self, record):
self.messages[record.levelname.lower()].append(record.getMessage())