I hereby claim:
- I am safplusplus on github.
- I am safplusplus (https://keybase.io/safplusplus) on keybase.
- I have a public key ASBR83QBiU6phsAxt15Rc-9h-GEJGv7iBt_uN68ooU-suwo
To claim this, I am signing this object:
| #!/bin/bash | |
| # Author: [email protected] | |
| # attempt at decent backup script | |
| # Some inspiration drawn from http://wiki.canarymod.net/Install_Canary | |
| INSTANCE="tk_prod" | |
| SESSION_NAME="tk_prod" | |
| USER="tk_prod" |
| #!/bin/bash | |
| # author: [email protected] | |
| echo "###### Starting at `date '+%Y-%m-%m %H:%M:%S'` ######" | |
| echo "Thining out quarter hourly backups to hourly backups..." | |
| # delete non-hourly backups older than 3 days | |
| find /opt/backup/minecraft/instances/tk_prod -maxdepth 2 -ctime +2 -type d -path '/opt/backup/minecraft/instances/tk_prod/????-??-??/??.??' -not -name '??.00' -exec echo "Going to delete {}" \; -exec rm -rf {} \; | |
| echo "Thining out hourly backups to daily backups..." |
| class ScopedHyperlinkedRelatedField(serializers.HyperlinkedRelatedField): | |
| """ A subclass of the HyperlinkRelatedField which attempts to scope on provider/zone """ | |
| def get_queryset(self): | |
| user = self.context['request'].user | |
| if user.is_superuser: | |
| queryset = self.queryset | |
| else: | |
| queryset = self.queryset.filter(zone__provider__groups__user=user) | |
| if isinstance(queryset, (QuerySet, Manager)): | |
| queryset = queryset.all() |
| from rest_framework import serializers | |
| from .models import TestModel | |
| class TestSerializer(serializers.HyperlinkedModelSerializer): | |
| class Meta: | |
| model = TestModel | |
| fields = ('name', 'reference') |
| from django.shortcuts import render | |
| from rest_framework import viewsets | |
| from .models import TestModel | |
| from .serializers import TestSerializer | |
| class TestViewSet(viewsets.ModelViewSet): | |
| queryset = TestModel.objects.all() | |
| serializer_class = TestSerializer |
| from django.db import models | |
| # Create your models here. | |
| class TestModel(models.Model): | |
| name = models.CharField(max_length=10) | |
| reference = models.ForeignKey('TestModel', blank=True, null=True) | |
| def __str__(self): | |
| return self.name |
I hereby claim:
To claim this, I am signing this object: