Skip to content

Instantly share code, notes, and snippets.

@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
import time
from statistics.tasks import test
for i in xrange(9999999):
test.delay('test - %s' % i)
time.sleep(2)
i+=1
print i
# 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)
@tomviner
tomviner / gist:4285213
Created December 14, 2012 12:41 — forked from seb-thomas/gist:4285197
with if?
$.getJSON('media/js/markers.json', function(data){
$.each(data.markers, function(i, marker){
if (...) {
map.addMarker({
id: i,
tags: marker.tag,
lat: marker.latitude,
lng: marker.longitude,
infoWindow: {
content: '<h2>' + marker.name + '</h2><p>' + marker.address + '</p>'
@tomviner
tomviner / s3_test.py
Created September 11, 2012 14:30
Simple example of an S3 django storage backend saving a file from local and url
import os
import urllib2
import contextlib
import StringIO
from django.core.files.storage import get_storage_class, FileSystemStorage
from django.core.files import File
from django.conf import settings
from galleries.models import GalleryImage
@tomviner
tomviner / Install-instructions-for-mac.txt
Created August 28, 2012 09:34
Homemade 2012 ticket notifier
curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
curl -O http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz
tar xzf pip-0.7.2.tar.gz
cd pip-0.7.2
python setup.py install
easy_install pip
pip install requests
@tomviner
tomviner / pretty.py
Last active November 29, 2021 12:42
Parse ps output to show top CPU, memory and process count, summed over identically named processes
import string
def pretty_size(size):
"size in bytes"
size = int(size)
units = ' KMGTPE'+string.lowercase[::-1]
bytes = 'B'
i = 0
while size>1024:
@tomviner
tomviner / gist:3175280
Created July 25, 2012 09:29
sublime settings
{
"auto_complete_commit_on_tab": true,
"detect_slow_plugins setting": false,
"dictionary": "Packages/Language - English/en_GB.dic",
"find_selected_text": true,
"fold_buttons": false,
"folder_exclude_patterns":
[
".svn",
".git",
@tomviner
tomviner / formatted_django_sql.py
Created January 4, 2012 17:21
Print django database query with a little formatting
# eg qs = Product.objects.exclude(is_prebuy=True)
print re.sub(r'\b([A-Z]+)\b', r'\n\1\n\t', str(qs.query))
@tomviner
tomviner / guardiancartoons.ics
Created September 18, 2011 19:35
Guardian Cartoons as Google Calendar Widgets
BEGIN:VCALENDAR
X-WR-CALNAME;VALUE=TEXT:guardiancartoons
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTART;VALUE=DATE:20110917T00:00:00Z
DTEND;VALUE=DATE:20110918
SUMMARY:Martin Rowson on the arrest of UBS 'rogue trader' - cartoon
X-GOOGLE-CALENDAR-CONTENT-TITLE:Martin Rowson on the arrest of UBS 'rogue trader' - cartoon
X-GOOGLE-CALENDAR-CONTENT-ICON:http://www.guardian.co.uk/favicon.ico