This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
test -z $1 && exit 1 | |
name=$1 | |
cpus=$(( $(sysctl -n hw.ncpu) / 2)) | |
mems=$(( $(sysctl -n hw.memsize) / 1024 ** 2 / 2)) | |
#iso=debian-testing-amd64-netinst.iso | |
iso=debian-8.2.0-amd64-netinst.iso | |
#preseed="testing-preseed.txt" | |
preseed="jessie-preseed.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSTALLED_APPS = ( | |
(snip) | |
'django_auth_custom_example', # <-- | |
) | |
MIDDLEWARE_CLASSES = ( | |
(snip) | |
'django.contrib.auth.middleware.AuthenticationMiddleware', | |
'django_auth_custom_example.middleware.CustomAuthMiddleware', # <-- | |
(snip) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from rest_framework.authentication import BaseAuthentication | |
from rest_framework import exceptions, HTTP_HEADER_ENCODING | |
from django_auth_custom_example.models import CustomAuthToken | |
def get_authorization_header(request): | |
auth = request.META.get('HTTP_X_AUTH_TOKEN', b'') | |
if isinstance(auth, type('')): | |
auth = auth.encode(HTTP_HEADER_ENCODING) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
from django.db import models | |
from django.contrib.auth.models import User | |
class CustomAuthToken(models.Model): | |
TOKEN_TYPE_CHOICES = ( | |
('user', 'user'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
from django.conf import settings | |
from django.contrib.auth.models import User | |
from django.utils.timezone import utc | |
from custom_authlib import client # client library for custom authentication | |
from django_auth_custom_example.models import CustomAuthToken | |
class CustomAuthBackend(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from django.contrib.auth import authenticate, login | |
from django.http import HttpResponseRedirect | |
from django.conf import settings | |
class CustomAuthMiddleware(object): | |
def process_request(self, request): | |
_token = None |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define("travis/adapters/application", ["exports", "ember-data", "travis/config/environment"], function(e, t, a) { | |
"use strict"; | |
var r; | |
r = t["default"].ActiveModelAdapter.extend({ | |
host: a["default"].apiEndpoint, | |
coalesceFindRequests: !0, | |
ajaxOptions: function(e, t, a) { | |
var r, n, i; | |
return n = this._super(e, t, a), n.headers || (n.headers = {}), n.headers.accept = "application/json; version=2", (i = Travis.sessionStorage.getItem("travis.token")) && ((r = n.headers).Authorization || (r.Authorization = "token " + i)), n | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# You must install curl, python2, python3, python3-pyvenv in advance. | |
if [ -z $1 ]; then | |
echo 'input pyvenv directory' && read targetdir | |
else | |
targetdir=$1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nodes": [ | |
{ | |
"color": "", | |
"r": "6", | |
"link": "", | |
"name": "backup2swift" | |
}, | |
{ | |
"color": "#5F9EA0", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
unset LANG | |
key="" | |
ctime="+0" | |
test -z $1 && ctime="-365" | |
test -z $2 && key="total" | |
check_python() { | |
printf "%-12s:" "Python" |