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 logging | |
import traceback | |
log = logging.getLogger('sqlalchemy.pool') | |
class DebugHandler(logging.StreamHandler): | |
def emit(self, record): | |
text = self.format(record) | |
if "checked out from" in text: | |
traceback.print_stack() | |
log.addHandler(DebugHandler()) |
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 { | |
listen 80 default_server; | |
server_name _; | |
return 404; #444 for empty response | |
} | |
server { | |
listen 443 ssl default_server; | |
server_name _; | |
ssl_certificate /your/cert.crt; |
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
size_t stacksize; | |
pthread_attr_t attr; | |
pthread_attr_init(&attr); | |
pthread_attr_getstacksize (&attr, &stacksize); | |
printf("Default stack size = %d\n", stacksize); | |
exit(0); |
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 re | |
import datetime | |
import time | |
r = re.compile(r'\[([\.\d]+)\].+\[(\d+/\w+/\d+:\d+:\d+:\d+ \+0400)\].+Mistress') | |
with open(sys.argv[1]) as f: | |
for line in f: | |
line = line.strip() | |
m = r.match(line) |
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
SELECT e.source_id, COUNT(e.*) | |
FROM entries AS e | |
INNER JOIN users__sources AS sassoc | |
ON sassoc.source_id = e.source_id AND sassoc.user_id = :user_id | |
LEFT JOIN users__entries AS eassoc | |
ON eassoc.entry_id = e.id AND eassoc.user_id = :user_id | |
WHERE eassoc.entry_id IS NULL OR eassoc.is_read = FALSE | |
GROUP BY e.source_id |
NewerOlder