from django.contrib.auth.models import AnonymousUser | |
from rest_framework.authtoken.models import Token | |
from channels.db import database_sync_to_async | |
from channels.middleware import BaseMiddleware | |
from project.settings import SIMPLE_JWT, SECRET_KEY | |
from urllib.parse import parse_qs | |
import jwt | |
@database_sync_to_async | |
def get_user(token_key): |
What is this?
It's a simple markdown copy of a16z's crypto canon, so anyone interested can fork this and keep track of their reading.
Original source: https://a16z.com/2018/02/10/crypto-readings-resources/
def patch_geos_signatures(): | |
""" | |
Patch GEOS to function on macOS arm64 and presumably | |
other odd architectures by ensuring that call signatures | |
are explicit, and that Django 4 bugfixes are backported. | |
Should work on Django 2.2+, minimally tested, caveat emptor. | |
""" | |
import logging |
The only way I've succeeded so far is to employ SSH.
Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config
file in a .ssh
directory. The config
file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh
directory by default. You can navigate to it by running cd ~/.ssh
within your terminal, open the config
file with any editor, and it should look something like this:
Host * AddKeysToAgent yes
> UseKeyChain yes
Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create
. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.
Note that on Heroku, you must always use master
as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch
seen below (in this example, we push the local staging
branch to the master
branch on heroku.
$ git remote add staging https://git.heroku.com/staging-app.git
class CaptureQueries(object): | |
""" | |
Context manager that captures queries executed by the specified connection. | |
Mostly copied from django.test.utils.CaptureQueriesContext. | |
""" | |
def __init__(self, connection = None): | |
if connection is None: | |
from django import db | |
connection = db.connection | |
import OpenGL.GL as GL | |
import OpenGL.GL.shaders | |
import ctypes | |
import pygame | |
import numpy | |
vertex_shader = """ | |
#version 330 | |
in vec4 position; |