This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.shortcuts import render | |
from django.views.generic import FormView | |
from .utils.error_reporter import report_error_if_violates as report_vio | |
from .utils.atcoder_history import AtCoderUserHistory, AtCoderUserHistoryStatistics | |
from .utils.atcoder_figure import AtCoderFigure | |
from .utils.base64_graph import base64_png | |
from .forms import UserNamesForm | |
from atcoderapps.settings import SOCIAL_AUTH_TWITTER_KEY, SOCIAL_AUTH_TWITTER_SECRET | |
from django.contrib.auth.decorators import login_required | |
from social_django.models import UserSocialAuth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import BytesIO | |
import base64 | |
def base64_png(matplot_figure): | |
buff = BytesIO() | |
matplot_figure.canvas.print_png(buff) | |
base64_data = base64.b64encode(buff.getvalue()) | |
return str(base64_data)[2:-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib | |
matplotlib.use('agg') # async handler deleted by the wrong thread を防ぐ | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
AREA_COLOR = [ | |
[5000, 3600, '#fcde5e'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval(%w(n=5;esc=(27 | |
.chr);ob=(91.chr);ST | |
DERR.print(esc+ob+"H"+ | |
esc+ob+"J");eval(%Q(sp | |
=(32.chr);esc=(27.chr) | |
;bs=(92.chr);ob=(91.chr) | |
;cb=(93.chr);STDERR.puts(s | |
p*2+ob+sp+cb);STDERR.puts(sp | |
+"/"+sp*3+bs);STDERR.puts("/"+ | |
sp*5+bs);(5-#{n}).times{STDERR.p |