Skip to content

Instantly share code, notes, and snippets.

# based on http://django-filer.readthedocs.org/en/0.9.2/upgrading.html#from-pre-0-9a3-develop-to-0-9
import sys, os
from django.conf import settings
from filer.models import File
print 'PUBLIC\N'
for f in File.objects.filter(is_public=True):
sys.stdout.write(u'moving %s to public storage... ' % f.id)
import time
from statistics.tasks import test
for i in xrange(9999999):
test.delay('test - %s' % i)
time.sleep(2)
i+=1
print i
@tomviner
tomviner / configure-vlc-srpos-plugin-output.txt
Created February 11, 2013 20:34
Output of ./configure vlc-srpos-plugin
libsrpos_plugin-0.2$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking how to print strings... printf
@tomviner
tomviner / updated?
Last active December 13, 2015 21:38 — forked from seb-thomas/updated?
with console.logs
var YOUR_API_KEY = ''
var dateUpdated = "";
function changeTitle() {
var favi = jQuery('[rel="shortcut icon"]');
var titleDate = jQuery('p.author a').last().attr('title');
var reDate = /(\d+)\/(\d+)\/(\d+)/;
//Swap year and day, convert to Date obj
titleDate = (titleDate).replace(reDate, "$3/$2/$1");
@tomviner
tomviner / reldate.js
Created February 27, 2013 10:22
The next Redmine update: keep relative times up-to-date
// locate and parse all relative time links on the page
var reDate = /(\d+)\/(\d+)\/(\d+)/;
jQuery('a[title]').map(function(){
var a = jQuery(this);
if ((a.text() && a.text().length===0) || !a.attr('title').match(reDate) ){return 0}
var d = new Date(a.attr('title').replace(reDate, "$3/$2/$1"));
return 'make_relative('+d+')';
})
if(typeof jQuery !== 'undefined'){
jQuery(function($) {
var dateUpdated = "";
var reDate = /(\d+)\/(\d+)\/(\d+)/;
var reIssues = /issues\/\d+/;
var titleDate = $('p.author a').last().attr('title');
var style= 'position: fixed;bottom: 0px;margin-bottom: 0px;width: 100%;padding: 12px 0px 13px 30px;background-position-y: 12px;';
var warning = '<div class="flash warning" style="'+style+'">This issue has been updated since you last saw it. <a href="javascript:location.reload(true);">Refresh now</a></div>';
@tomviner
tomviner / admin.py
Last active December 14, 2015 21:49
from django.contrib import admin
from django.db.models.loading import get_models
# BaseAdmin does things like default list_display to all fields
from core.admin import BaseAdmin
import models as legacy_models
for mod in get_models(legacy_models):
if mod not in admin.site._registry:
@tomviner
tomviner / bash_colours.sh
Created March 13, 2013 17:24
Bash prompt colours, including coping with venvs
# colours are from http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
# in $WORKON_HOME/postactivate
PS1="(`basename $VIRTUAL_ENV`)$BASE_PS1"
# in $WORKON_HOME/postdeactivate
PS1=$BASE_PS1
# in startup eg ~/.bashrc
@tomviner
tomviner / page.html
Created March 21, 2013 15:26
DDoS protection by CloudFlare
$ GET http://xyz.com/14015/forxxx
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>Just a moment...</title>
<link rel="stylesheet" media="screen" href="/cdn-cgi/styles/js-challenge/error.css" type="text/css">
</head>
<body>
@tomviner
tomviner / binarySplitCountChange.dot
Last active December 15, 2015 18:30
Scala Q3 countChange generated dot notation of call graph
graph binarySplitCountChange {
"1:ch(3,List(1, 2, 3))" -- "2:ch(2,List(1, 2, 3))";
"1:ch(3,List(1, 2, 3))" -- "2:ch(3,List(2, 3))";
"2:ch(2,List(1, 2, 3))" -- "3:ch(1,List(1, 2, 3))";
"2:ch(2,List(1, 2, 3))" -- "3:ch(2,List(2, 3))";
"3:ch(1,List(1, 2, 3))" -- "4:ch(0,List(1, 2, 3))";
"3:ch(1,List(1, 2, 3))" -- "4:ch(1,List(2, 3))";
"4:ch(1,List(2, 3))" -- "5:ch(-1,List(2, 3))";
"4:ch(1,List(2, 3))" -- "5:ch(1,List(3))";
"5:ch(1,List(3))" -- "6:ch(-2,List(3))";