Django manages media based on the following definitions:
BASE_DIR = /var/praekelt/telkom-spliceworks/
MEDIA_ROOT = "%s/media/" % BASE_DIR
*.img | |
*.raw |
from celery import Task | |
from celery.task import task | |
from my_app.models import FailedTask | |
from django.db import models | |
@task(base=LogErrorsTask) | |
def some task(): | |
return result | |
class LogErrorsTask(Task): |
class TransactionAwareTask(Task): | |
''' | |
Task class which is aware of django db transactions and only executes tasks | |
after transaction has been committed | |
''' | |
abstract = True | |
def apply_async(self, *args, **kwargs): | |
''' | |
Unlike the default task in celery, this task does not return an async |
from django.contrib.admin import ModelAdmin | |
class MyTableAdmin(ModelAdmin): | |
... | |
paginator = LargeTablePaginator | |
... | |
<?php | |
/** | |
* @param $baseUrl - non protected part of the URL including hostname, e.g. http://example.com | |
* @param $path - protected path to the file, e.g. /downloads/myfile.zip | |
* @param $secret - the shared secret with the nginx server. Keep this info secure!!! | |
* @param $ttl - the number of seconds until this link expires | |
* @param $userIp - ip of the user allowed to download | |
* @return string | |
*/ |
#!/usr/bin/env python | |
from subprocess import * | |
import sys | |
import re | |
# Add Regex to blacklist here | |
blacklist = [ | |
"\+[ ]+NSLog.+" # Prevent NSLog's from being added | |
] |
def bulk_upsert(model, fields, values, by): | |
""" | |
Return the tuple of (inserted, updated) ids | |
""" | |
result = (None, None) | |
if values: | |
stmt = """ | |
WITH data_set AS ( | |
INSERT INTO %s (%s) |
using System; | |
using System.Linq; | |
namespace layered | |
{ | |
class MainClass | |
{ | |
public static void Main(string[] args) { | |
var data = new DataLayer(); | |
var business = new BusinessLayer(data); |