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
!Microsoft IME Dictionary Tool | |
!Version: | |
!Format:WORDLIST | |
!User Dictionary Name: C:\Users\yuji\AppData\Roaming\Microsoft\IME\15.0\IMEJP\UserDict\MMDAgent.dic | |
!Output File Name: C:\Users\yuji\Desktop\MMDAgentIME.txt | |
!DateTime: | |
MODEL_ADD MODEL_ADD 短縮よみ MMDAgentのシナリオスクリプト用 | |
MODEL_CHANGE MODEL_CHANGE 短縮よみ | |
MODEL_DELETE MODEL_DELETE 短縮よみ |
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 random | |
import time | |
# 区間[0,9999]のランダムな整数をN個格納したリストを作成 | |
N = 1000000 | |
rands = [random.randrange(10000) for _ in range(N)] | |
def f_or(rands): | |
""" 0~9999までのorの列挙 """ | |
start = time.time() |
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 email | |
import ssl | |
import imaplib | |
from email.header import decode_header, make_header | |
# https://docs.python.jp/3/library/imaplib.html | |
# [参考]https://qiita.com/ekzemplaro/items/a35e15865d57372f1d2b | |
# https://docs.python.jp/3.6/library/email.message.html | |
# https://docs.python.org/ja/3.7/library/email.compat32-message.html#module-email.message | |
# https://docs.python.jp/3.6/library/email.parser.html |
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 email | |
import ssl | |
import subprocess | |
import imaplib | |
from email.header import decode_header, make_header | |
# https://docs.python.jp/3/library/imaplib.html | |
# [参考]https://qiita.com/ekzemplaro/items/a35e15865d57372f1d2b | |
# https://docs.python.jp/3.6/library/email.message.html | |
# https://docs.python.org/ja/3.7/library/email.compat32-message.html#module-email.message | |
# https://docs.python.jp/3.6/library/email.parser.html |
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 collections import deque | |
import time | |
N = 2*10**5 | |
def list_append(): | |
a = [] | |
start = time.time() | |
for i in range(N): |
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 time | |
def sample_in_operator1(dic, N): | |
""" in演算子(見つかる) """ | |
start = time.time() | |
for i in range(N): | |
if i in dic: |
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
// popup.htmlからQiitaページのXHRテスト(CORS制約を突破できるか?)(できている!2019/09/06) | |
// Qiitaのプロフィールページからアイコン画像を取得する | |
const url = 'https://qiita.com/takey'; | |
function get(url) { | |
return new Promise(function(resolve, reject) { | |
let xhr = new XMLHttpRequest(); | |
xhr.open('GET', url, true); | |
xhr.responseType = "document"; |
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 math import floor | |
N = 1000000000000000000 # 10**18 | |
# //演算子を使った場合、意図した値になる | |
a = N//3 | |
print(a) | |
# 333333333333333333 | |
# floor()を使った場合、意図しない値になる | |
b = floor(N/3) |
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 struct | |
def double_to_hex(f): | |
""" float値を16進数文字列に変換する | |
参考: https://note.nkmk.me/python-float-hex/ | |
""" | |
return hex(struct.unpack('>Q', struct.pack('>d', f))[0]) | |
def double_to_bin(f): |
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
# coding: utf-8 | |
import math | |
def entropy(p_list): | |
ans = 0 | |
for p in p_list: | |
ans += (p) * -math.log2(p) | |
return ans | |
p_list = [1.0] |
OlderNewer