Skip to content

Instantly share code, notes, and snippets.

View shimakaze-git's full-sized avatar

shimakaze-git shimakaze-git

View GitHub Profile
import os
import glob
import time
import zipfile
import sys
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
@shimakaze-git
shimakaze-git / serializers.py
Last active October 29, 2019 06:04
PasswordResetSerializer
from django.conf import settings
from django.contrib.auth.forms import PasswordResetForm
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
class PasswordResetSerializer(serializers.Serializer):
"""
Serializer for requesting a password reset e-mail.
def make_password(password, salt=None, hasher='default'):
"""
Turn a plain-text password into a hash for database storage
Same as encode() but generate a new random salt. If password is None then
return a concatenation of UNUSABLE_PASSWORD_PREFIX and a random string,
which disallows logins. Additional random string reduces chances of gaining
access to staff or superuser accounts. See ticket #20079 for more info.
"""
if password is None:
@shimakaze-git
shimakaze-git / base_user.py
Created October 20, 2019 06:33
base_user.py
def set_password(self, raw_password):
self.password = make_password(raw_password)
self._password = raw_password
@shimakaze-git
shimakaze-git / app.yaml
Created September 7, 2019 14:11
GAEの設定ファイルであるapp.yamlの内容
runtime: python37
service: sample_django
handlers:
- url: /.*
script: auto
- url: /static
static_dir: static/
@shimakaze-git
shimakaze-git / list.py
Last active September 1, 2019 11:31
リスト内包表記とlistでは確保されているメモリサイズが違う
# python 3.7.3 macOS
import sys
# リスト rangeによる確保
val = list(range(10))
get_size = sys.getsizeof(val)
print(get_size)
# 200
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.min.js"></script>