I hereby claim:
- I am coci on github.
- I am coci (https://keybase.io/coci) on keybase.
- I have a public key ASDVQo88kttH7Pxmtt9NFlJBgnjQ2fAzTXQOjgQ7ZJFDMQo
To claim this, I am signing this object:
| import math | |
| def reverse_int_without_string(number): | |
| """ | |
| reverse without change number into string | |
| """ | |
| number_copy = abs(number) | |
| digits_number = [] # split number by their digits | |
| while number_copy > 0 : | |
| digits_number.append(number_copy%10) |
I hereby claim:
To claim this, I am signing this object:
| """ | |
| Jwt middleware for django channels | |
| """ | |
| from django.conf import settings | |
| from django.contrib.auth.models import AnonymousUser | |
| from jwt import decode as jwt_decode | |
| from rest_framework_simplejwt.exceptions import InvalidToken, TokenError | |
| from rest_framework_simplejwt.tokens import UntypedToken |
| from __future__ import absolute_import | |
| import os | |
| from celery import Celery | |
| from django.conf import settings | |
| # set the default Django settings module for the 'celery' program. | |
| os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sample.settings') | |
| app = Celery('sample') | |
| # Using a string here means the worker will not have to |
| if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
| source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
| fi | |
| ZSH_THEME="robbyrussell" | |
| plugins=(git) | |
| source $ZSH/oh-my-zsh.sh | |
| source ~/powerlevel10k/powerlevel10k.zsh-theme |
A running example of the code from:
This gist creates a working example from blog post, and a alternate example using simple worker pool.
TLDR: if you want simple and controlled concurrency use a worker pool.