I hereby claim:
- I am respondcreate on github.
- I am respondcreate (https://keybase.io/respondcreate) on keybase.
- I have a public key whose fingerprint is BCBA 1B5B D4E9 F90C 555F F06D FBE9 293B 068B AD86
To claim this, I am signing this object:
{ | |
"author": "respondcreate", | |
"keyboard": "niu_mini", | |
"keymap": "niu_mini--je-20190605", | |
"layers": [ | |
[ | |
"KC_TAB", | |
"KC_Q", | |
"KC_W", | |
"KC_E", |
"""How to validate Okta Access Tokens Locally with Python""" | |
import jwt | |
from jwt.algorithms import RSAAlgorithm | |
# Key pulled from https://{example}.oktapreview.com/oauth2/{client-id}/v1/keys | |
key_json = '{"kty":"RSA","alg":"RS256","kid":"your-kid-value-here","use":"sig","e":"AQAB","n":"your-long-key-here"}' | |
aud = "your-audience-value-here" | |
token_to_validate = "your-access-token-value-here" |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "s3:*Object*", | |
"Resource": [ | |
"arn:aws:s3:::{bucket-name}/static/*", | |
"arn:aws:s3:::{bucket-name}/media/*" | |
] |
#!/bin/bash | |
sudo yum -y update | |
sudo yum install -y ruby | |
sudo yum install -y aws-cli | |
sudo yum install -y docker | |
sudo yum install wget -y | |
sudo service docker start | |
sudo usermod -a -G docker ec2-user | |
sudo pip install docker-compose | |
cd /home/ec2-user |
I hereby claim:
To claim this, I am signing this object:
description "Gunicorn application server running myproject" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
setuid median | |
setgid www-data | |
env PATH=/home/user/myproject/ENV/bin |
from django.http import HttpResponseForbidden | |
class RequiredGroupMixin(object): | |
""" | |
Ensure only logged in users who belong to a particular group (or groups) | |
can access this view. | |
To use this Mixin, just include it as a subclass to your view and add a | |
new attribute, `restrict_to_groups`, as an iterable of allowed group names. |
# You'll need lxml, install it like this: | |
# $ pip install lxml | |
# Import objectify from lxml | |
from lxml import objectify | |
# Open the XML file in question | |
f = open('/path/to/xml/file.xml', 'r') | |
#Ensure the file is ready for parsing | |
f.seek(0) |
from django.db import models | |
from django.contrib.contenttypes.models import ContentType | |
from polymorphic.models import PolymorphicLink | |
class SomeClass(models.Model): | |
"""Some attributes""" | |
def _get_features(self): | |
ct = ContentType.objects.get(app_label=self._meta.app_label, name=self._meta.verbose_name) | |
features_set = PolymorphicLink.objects.filter(parent_content_type=ct, parent_object_id=self.pk) |