# -*- coding: utf-8 -*-
#Copyright (c) 2009 Eugene Kaznacheev <>
#Copyright (c) 2013 Joshua Tasker <>
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without
#restriction, including without limitation the rights to use,
import datetime
import os
import tarfile
import time
from django.conf import settings
from django.core.mail import mail_admins
from import BaseCommand
from boto.s3.connection import S3Connection
View TableVerticalSplitHack.js
* WkHtmlToPdf table vertically-splitting hack
* Script to automatically split wide HTML tables that doesn't fit the width of the PDF page generated
* by WkHtmlToPdf (or equivalent)
* The general idea come from Florin Stancu <> and his script wkhtmltopdf.tablesplit.js
* The implementation is quite different because the splitting is done vertically on a excessive
* wide table, while the original script was meant to split horizontally an excessive long table
* To use, you must adjust pdfPage object's contents to reflect your PDF's
View dashboard.js
var app = new Vue({
http: {
headers: {
"X-CSRFToken": window.csrf_token
el: "#admin-dash-users",
data: {
addresses: [],
count: 0,
View pre-commit
#!/usr/bin/env bash
head=`git symbolic-ref HEAD`
#if echo $head | grep -E 'releases?/[0-9]\.[0-9]+|master'
# echo "You cannot commit directly to a release branch"
# echo "Stash your changes and apply them to another branch"
# echo "or create a branch directly from these changes"
View mikee.php
<!DOCTYPE html>
<label for="notes">Notes</label>
<input class="u-full-width" placeholder="notes" id="notes" type="text">
<input class="button-primary" value="submit" type="submit">
View Solr Traceback.xml
<lst name="responseHeader">
<int name="status">500</int>
<int name="QTime">10</int>
<lst name="error">
<str name="msg">Exception writing document id student.student.5x to the index; possible analysis error.</str>
<str name="trace">org.apache.solr.common.SolrException: Exception writing document id student.student.5x to the index;
possible analysis error. at org.apache.solr.update.DirectUpdateHandler2.addDoc(
at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.jav a:69)
from mongoengine.connection import connect, disconnect
from django.test import TestCase
from django.conf import settings
class MongoTestCase(TestCase):
TestCase class that clear the collection between the tests
def doubles(iterable):
"""Helper function that return a decoupled iterator"""
return zip(iterable, iterable)
nginx_line = r'(?P<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})?(?P<ip2>, \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})?-? - ?\S* \[(?P<timestamp>\d{2}\/\w{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\]\s+\"(?P<method>\S{3,10}) (?P<path>\S+) HTTP\/1\.\d" (?P<response_status>\d{3}) (?P<bytes>\d+) "(?P<referer>(\-)|(.+))?" "(?P<useragent>.+)'
Matches request lines from Nginx log format
'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$request_time" "$upstream_response_time" "$http_x_forwarded_for" '
'"$http_client_ip" "$http_x_real_ip"';