Skip to content

Instantly share code, notes, and snippets.

@noimin0610
noimin0610 / views.py
Last active December 2, 2018 07:10
AtCoder Performances ソースコード (一部)
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
@noimin0610
noimin0610 / base64_png.py
Created December 2, 2018 06:29
AtCoder Performances ソースコード (一部)
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]
@noimin0610
noimin0610 / atcoder_figure.py
Last active December 2, 2018 06:29
AtCoder Performances のソースコード (一部)
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'],
@noimin0610
noimin0610 / quine-like.rb
Created June 3, 2018 11:14
クックパッド1dayインターンシップ 超絶技巧プログラミング
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