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
# /// script | |
# dependencies = ["win32more"] | |
# /// | |
import asyncio | |
import threading | |
from concurrent.futures import Future | |
from queue import Queue | |
from win32more import WinError |
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
# Asyncio guest mode | |
# | |
# [Using “guest mode” to run Trio on top of other event loops](https://trio.readthedocs.io/en/stable/reference-lowlevel.html#using-guest-mode-to-run-trio-on-top-of-other-event-loops) | |
# | |
# | |
# Trio's guest mode model | |
# | |
# UI thread Asyncio thread | |
# | |
# +------------+ |
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
# Authenticate Outlook SMTP connection using OAuth | |
# | |
# 1. Create account at https://portal.azure.com/ | |
# | |
# 2. Register New App to Microsoft Entra ID. | |
# Select Native Application. | |
# Select "Personal Microsoft accounts only". | |
# Set redirect_uri. | |
# It seems that No API permission required. | |
# |
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
# -------------------------------------- | |
# TOA .pmf file | |
# -------------------------------------- | |
# uint8_t id[32]; // "N-8000 message\r\n" | |
# uint8_t name[128]; // Name encoded in Shift-JIS | |
# uint8_t created[32]; // Created date: yyyy-mm-dd HH:MM:SS | |
# uint32_t audio16k_size; // Size of 16k audio data | |
# uint32_t audio8k_size; // Size of 8k audio data | |
# uint32_t checksum; // Sum of audio16k_data and audio8k_data | |
# uint8_t audio16k_data[audio16k_size]; // Audio data: G722 16k sample rate 16bit mono |
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 ctypes | |
import inspect | |
class GlobalFirstAndNoClassPrivateNamespace: | |
def __init__(self, name, globals_): | |
self._class_scope = f"_{name}" | |
self._globals = globals_ | |
self._dict = {} | |
def __getitem__(self, key): |
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
// mydumpbin.c | |
// | |
// Reference: | |
// http://msdn.microsoft.com/msdnmag/issues/02/03/PE2/default.aspx | |
// http://forums.belution.com/ja/vc/000/234/78s.shtml | |
// http://nienie.com/~masapico/api_ImageDirectoryEntryToData.html | |
// http://www.geocities.jp/i96815/windows/win09.html | |
// http://hp.vector.co.jp/authors/VA050396/index.html | |
#include <windows.h> |
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 sys | |
import clang.cindex | |
clang.cindex.Config.set_library_path(r'C:\Program Files\LLVM\bin') | |
def visit(cursor, indent): | |
print("%s[KIND:%s] { extent: { File:%s, start:{ l:%d, c:%d }, end {l:%d, c:%d } } , spelling:%s, type:{ kind:%s, spelling:%s } }" % ( | |
' ' * indent, | |
cursor.kind.name, | |
cursor.extent.start.file, |
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
# 国立国会図書館サーチを使って新刊コミック(に限らず)を検索する | |
# | |
# 国立国会図書館サーチ API仕様の概要 | |
# https://iss.ndl.go.jp/information/api/riyou/ | |
# | |
# 2019年4月1日 国立国会図書館の書誌データは、様々な用途で自由にご利用いただけます | |
# https://www.ndl.go.jp/jp/news/fy2019/190401_02.html | |
# | |
# 出版情報登録センターとの連携強化による機能改善のお知らせ | |
# https://iss.ndl.go.jp/information/2018/06/28_announce_jpro/ |
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
// public domain | |
// | |
// Windows10 のバックアップ(ファイル履歴)は半角全角違いの同名ファイルを扱えない | |
// が、バックアップがどこで失敗してるのかは教えてくれないので、バックアップでき | |
// ていないファイルを見つけるスクリプト。 | |
// | |
// using https://github.com/Microsoft/ManagedEsent | |
// csc fhverify.cs /r:Esent.Interop.dll | |
// | |
// NOBACKUP: 最新のファイルが(まだ)バックアップされていない(データベースにエントリがない) |
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
// Mlang via COM example. | |
// https://msdn.microsoft.com/en-us/library/aa767865.aspx | |
#pragma comment(lib, "ole32.lib") | |
#include <windows.h> | |
#include <mlang.h> | |
#include <stdio.h> | |
#include <string.h> |
NewerOlder