Skip to content

Instantly share code, notes, and snippets.

View coci's full-sized avatar
:octocat:
On the way

soroush safari coci

:octocat:
On the way
View GitHub Profile
@coci
coci / golang_job_queue.md
Created May 10, 2022 10:46 — forked from harlow/golang_job_queue.md
Job queues in Golang
@coci
coci / zshrc
Created August 18, 2021 06:06
my zsh config
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
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
"""
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

Keybase proof

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)
to create initial data for models in django :
1- create "fixtures" dir inside app
2- add fx.json file init
3- add data like :
[
{
"model": "activity.Todo",
"pk": 1,
"fields": {
"name": "buy food"
# in this seriliazer : 'user' is forignkey to customuser
# i need add user name and pk instead of pk only
class LandSerializer(serializers.ModelSerializer):
points = PointSerializer(many=True, read_only=True)
class Meta:
model = Land
fields = ('pk', 'user', 'name', 'create_time', 'points')
class Stack:
def __ini__(self):
self.array = []
def push(self,item):
self.array.append(itme)
def pop(self):
return self.array.pop()
def isEmpty(self):
return True if len(array) > 0 else False
class Stack:
def __ini__(self):
self.array = []
def push(self,item):
self.array.append(itme)
def pop(self):
return self.array.pop()
def isEmpty(self):
return True if len(array) > 0 else False