This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import subprocess | |
from requests_oauthlib import OAuth1Session | |
import requests | |
import base64 | |
import json | |
import os | |
import sys |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import random | |
np = lambda : random.random()*2-1 | |
pi = lambda N: sum([1.0 for i in xrange(N) if np()**2+np()**2 <= 1.0]) * 4.0 / float(N) | |
print pi(100000) |
This file contains hidden or 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 os | |
import urllib | |
import urllib2 | |
import argparse | |
import json | |
class Crawler(object): | |
endpoint = 'https://api.photozou.jp/rest/search_public.json' | |
imgurl = 'http://photozou.jp/p/img/' |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import re | |
import json | |
import requests | |
from requests_oauthlib import OAuth1Session |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import requests | |
import json | |
from datetime import date | |
def make_month_prog_msg(work): | |
grades = ['B4', 'M1', 'M2'] | |
month = date.today().month | |
return '{}さん,{}の進捗どうですか?'.format(grades[month%3], work) |
This file contains hidden or 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
{% extends "layout.html" %} | |
{% block body %} | |
< svg width="283" height="135"> | |
{% for record in records %} | |
{% if (loop.index-1)%7 == 0 %} | |
<g transform="translate({{ (loop.index-1)/7*17 + 18 }}, 18)"> | |
<rect x="0" y="{{ (loop.index-1)%7*17 }}" width="15" height="15" data-original-title="{{ loop.index }}" style="fill:rgb({{ record.r}}, {{ record.g }}, {{ record.b }});"></rect> | |
{% elif (loop.index-1)%7 < 6 %} | |
<rect x="0" y="{{ (loop.index-1)%7*17 }}" width="15" height="15" data-original-title="{{ loop.index }}" style="fill:rgb({{ record.r}}, {{ record.g }}, {{ record.b }});"></rect> | |
{% else %} |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from datetime import date | |
def main(filename): | |
months = {'January': 1, | |
'February': 2, | |
'March': 3, | |
'April': 4, |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from _md5 import MD5Type as z | |
def is_flag(s): | |
# A = int(s[pow(ord(s[0]), 2) - ord(ZeroDivisionError.__name__[0b101]) * 0o105 + 19:]) | |
A = int(s[ pow(ord(s[0]), 2)-7226 :]) # 85**2=7225, s[0] = chr(85) = 'U', A = int(s[-1]) | |
# B = list(filter(lambda q: q % (int(z.__name__[::-3]) - 0b10) == 0, [A, A * 2, A * 3, A * 4, A * 5])) | |
B = list(filter(lambda q: q % 3 == 0, [A, A*2, A*3, A*4, A*5])) |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import requests | |
import os | |
import subprocess | |
def fetch_commit_object(url, commit): | |
if len(commit) != 40: |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import Image | |
import numpy as np | |
def hex2bin(hexmat): | |
binmattemp = [bin(m)[2:] for m in hexmat] | |
rowlen = max([len(m) for m in binmattemp]) | |
binmat = [[0]+[int(b) for b in row.zfill(rowlen)] for row in binmattemp] |
OlderNewer