Skip to content

Instantly share code, notes, and snippets.

View taketakeyyy's full-sized avatar
🏠
Working from home

takey taketakeyyy

🏠
Working from home
  • Japan
View GitHub Profile
!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 短縮よみ
@taketakeyyy
taketakeyyy / measure_or_list_tuple_set.py
Last active October 11, 2018 07:31
or列挙、リスト、タプル、集合でのif文の速度評価 ref: https://qiita.com/takey/items/15b629a2c442222a68aa
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()
@taketakeyyy
taketakeyyy / imaplib_sample.py
Created October 15, 2018 08:37
imaplibのサンプルプログラム
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
@taketakeyyy
taketakeyyy / imap_command.py
Last active October 19, 2018 07:18
imaplibによるラズパイ遠隔操作のサンプルプログラム
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
@taketakeyyy
taketakeyyy / compare_list_and_deque.py
Created May 20, 2019 04:05
listとdequeの先頭の要素に対する操作の比較
from collections import deque
import time
N = 2*10**5
def list_append():
a = []
start = time.time()
for i in range(N):
@taketakeyyy
taketakeyyy / speed_compare_of_dict_in_try_get.py
Created June 2, 2019 09:14
Speed ​​comparison of dict with in-operator, try-except and get method.
"""
辞書におけるキーアクセスの速度比較
"""
import time
def sample_in_operator1(dic, N):
""" in演算子(見つかる) """
start = time.time()
for i in range(N):
if i in dic:
@taketakeyyy
taketakeyyy / XMLHttpRequest_GetDOM
Last active September 6, 2019 02:17
XMLHttpRequestのサンプル。非同期処理で指定したURLのDOMを取得する
// 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";
@taketakeyyy
taketakeyyy / kirisute_gomen.py
Last active August 28, 2019 09:37
math.floor()と//演算子の違いというかなんというか
from math import floor
N = 1000000000000000000 # 10**18
# //演算子を使った場合、意図した値になる
a = N//3
print(a)
# 333333333333333333
# floor()を使った場合、意図しない値になる
b = floor(N/3)
@taketakeyyy
taketakeyyy / double_to_bin.py
Last active September 5, 2019 08:51
数値を2進数の文字列(64bit長)に変換する。2進数の文字列を数値に変換する
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):
@taketakeyyy
taketakeyyy / entropy.py
Last active April 17, 2023 17:32
情報量としてのエントロピー増大とは?
# 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]