Skip to content

Instantly share code, notes, and snippets.

View mugwort-rc's full-sized avatar

mugwort_rc mugwort-rc

  • Japan
View GitHub Profile
@mugwort-rc
mugwort-rc / get_product_key.py
Created June 22, 2023 14:40
Retrieve Windows Product Key by python
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import sys
import winreg
def convert_to_key(key: bytes) -> str:
@mugwort-rc
mugwort-rc / README.md
Last active May 17, 2021 13:42
Visual Studio 2019 v16.8以降 で Windows 8.1 SDK を使用できない問題の解決方法

Visual Studio 2019 v16.8以降 で Windows 8.1 SDK を使用できない問題の解決方法

問題

1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(229,21): error C2760: 構文エラー: 予期しないトークン '識別子 '、必要なトークン '型指定子'
1>C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(229,21): error C2760: syntax error: unexpected token 'identifier', expected 'type specifier'

解決方法

#include <vector>
#include <boost/python.hpp>
boost::python::dict array_interface(const std::vector<double> &v) {
ArrayInterface iface(v);
boost::python::dict d;
d["shape"] = boost::python::make_tuple(1, 4, 1);
d["typestr"] = "|f8";
import Xerces
import os.path
SOURCE = """<root min="2" max="0"/>"""
class Handler(Xerces.ErrorHandler):
def __init__(self):
super(Handler, self).__init__()
self.exceptions = []
def warning(self, exc):
@mugwort-rc
mugwort-rc / LAGRANGE.txt
Last active September 1, 2017 09:21
Boost.Python Interface of C++ implementation (Boost.Multiprecision) of decimal.Decimal version of scipy.interpolate.lagrange
Boost.Python Interface of C++ implementation (Boost.Multiprecision) of decimal.Decimal version of scipy.interpolate.lagrange
@mugwort-rc
mugwort-rc / cabocha_xml.py
Last active June 29, 2017 15:03
CaboCha.FORMAT_XML ではエスケープ処理を行わないため lxml.etree を使用して適切なXMLを構築する
from lxml import etree
def cabocha_xml(tree):
root = etree.Element("sentence")
tmp = 0
for i in range(tree.chunk_size()):
chunk = tree.chunk(i)
elem = etree.SubElement(root, "chunk")
elem.attrib["id"] = str(i)
@mugwort-rc
mugwort-rc / obs_codes.py
Created April 13, 2017 15:27
Coordinate converter for List Of Observatory Codes (IAU Minor Planet Center)
#!/usr/bin/env python3
"""
Coordinate converter for List Of Observatory Codes (IAU Minor Planet Center)
<http://www.minorplanetcenter.net/iau/lists/ObsCodesF.html>
Usage: python3 obs_codes.py input.txt output.csv
Example:
@mugwort-rc
mugwort-rc / 00.README.md
Last active February 27, 2017 15:46
MeCab 0.996 with Boost.Iostreams on MSYS2/MinGW32

MeCab Windows版ではstd::fstream::fstream(const wchar_t *)という非標準のMSVC仕様を使用しており、MinGWでビルドができないことが不満だったため、強引にBoost.Iostreamsを使用してみました。

コンパイルが通ることはMSYS2のMinGW32でのみ確認しています。

  • 01.diff.patch
  • 02.mecab.h.patch
  • 03.config.h.patch
  • 04.Makefile.patch

01から順番にパッチを当ててください。

@mugwort-rc
mugwort-rc / ascii.txt.detach.asc
Created February 12, 2017 09:37
python-gnupg failure on detached sign
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJYoCabAAoJEMuvobDi3WQkqEYIAJNYvg46PO3L3bQICmihZj3t
Zhd6cdY19yXLgYVgCtdOXK88EDvdm1lDY7XeWrLuBEIw0pEhHuHRjdF7fbpZK4IC
EJqHhgARs8iEn+Crqq4r+nTw8fCyHV2K2fRE5KGeIr/J2Os1oqJ3IPAlinBQaSwp
rNF0Jb5/y+Hj1bvZmNxeqmeklzJrirA4bEwfU9/u2u6hSDvaj8mGkOg6MW3gLG83
YeOjiEBfz54zQmaBoqxfPwacy7MkSIAP7Bk32SzLGKZKvvz5YaHUrwMbz3QGoVNJ
I+9TVeQ6KtvbeD4H73n0xw73yD9hJlkZ22JECkplWd2Wu1e6qvt1FXC8pHK8WY0=
=hGhZ
@mugwort-rc
mugwort-rc / file0.txt
Last active February 13, 2017 09:31
WARCファイルフォーマット翻訳(仮) ref: http://qiita.com/mugwort_rc/items/459d4872168e2cc28ba1
warc-file = 1*warc-record
warc-record = header CRLF
block CRLF CRLF
header = version warc-fields
version = "WARC/1.0" CRLF
warc-fields = *named-field CRLF
block = *OCTET