Example inputs:
Variable | Value |
---|---|
key | the shared secret key here |
message | the message to hash here |
Reference outputs for example inputs above:
| Type | Hash |
from collections import defaultdict | |
import weakref | |
__refs__ = defaultdict(weakref.WeakSet) | |
def clear_refs(cls): | |
__refs__[cls].clear() |
Example inputs:
Variable | Value |
---|---|
key | the shared secret key here |
message | the message to hash here |
Reference outputs for example inputs above:
| Type | Hash |
# https://gist.github.com/1035190 | |
# See also: Snippets 85, 240, 880 at http://www.djangosnippets.org/ | |
# | |
# Minimally, the following settings are required: | |
# | |
# SSL_ENABLED = True | |
# SSL_URLS = ( | |
# r'^/some/pattern/', | |
# ) |
from django import forms | |
from django.db.models import FilteredRelation, Q | |
from django.urls import path | |
from django.contrib import admin | |
from django.contrib.auth import get_user_model | |
from django.http import HttpResponseRedirect | |
from django.template.response import TemplateResponse | |
from django.urls import reverse | |
from django.utils.http import urlencode | |
from django.utils.translation import ugettext_lazy as _ |
@admin.register(Order) | |
class OrderAdmin(admin.ModelAdmin): | |
list_display = [ | |
'name', | |
'status', | |
'add_product_action', | |
'add_mattress_action' | |
] | |
list_display_links = ['name', 'status'] | |
readonly_fields = [ |
#!/usr/bin/env python | |
# coding: utf-8 | |
class AttrDict(object): | |
def __init__(self, init=None): | |
if init is not None: | |
self.__dict__.update(init) | |
def __getitem__(self, key): | |
return self.__dict__[key] |
from django.db.models import ( | |
Avg, | |
Count, | |
DateField, | |
ExpressionWrapper, | |
F, | |
IntegerField, | |
Min, | |
Q, | |
Value |
from django.utils.functional import lazy | |
from django.utils.translation import ugettext_lazy as _ | |
from knowledge.models import Article | |
class ModeratedArticle(Article): | |
class Meta: | |
proxy = True |
from django.contrib.auth.signals import user_logged_in | |
from django.dispatch import receiver | |
from django.contrib.gis.geoip2 import GeoIP2 | |
from django.conf import settings | |
import geoip2 | |
from apps.mailer.tasks import send_template_email | |
from .models import LoginStatistics |
sudo apt-get install putty-tools | |
# Place your keys in some directory, e.g. your home folder. Now convert the PPK keys to SSH keypairs:cache search | |
# To generate the private key: | |
puttygen your_private_key.ppk -O private-openssh -o your_new_key | |
chmod 600 your_new_key | |
# Move these keys to ~/.ssh and make sure the permissions are set to private for your private key: | |
mkdir -p ~/.ssh |