Skip to content

Instantly share code, notes, and snippets.

@hideaki-t
hideaki-t / nvblas.md
Last active December 14, 2022 03:43
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hideaki-t
hideaki-t / show_xlsx_dimension.py
Last active March 16, 2017 14:43
show dimension of an xlsx file
import zipfile
import xml.sax
import sys
NS = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'
class NonLocalExit(Exception):
pass
@hideaki-t
hideaki-t / sqlite_spellfix1_python.ipynb
Last active July 30, 2016 14:42
SQLite spellfix1 with Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hideaki-t
hideaki-t / PKGBUILD
Created April 6, 2016 13:29
a fix for icu52 with clang
# Maintainer: Thomas Jost <[email protected]>
# Contributor: Andreas Radke <[email protected]>
# Contributor: Art Gramlich <[email protected]>
pkgname=icu52
_pkgname=icu
pkgver=52.1
pkgrel=1
pkgdesc="International Components for Unicode library"
arch=(i686 x86_64)
@hideaki-t
hideaki-t / levenshtein_distance.rs
Last active August 29, 2015 14:21
Unicode-aware Levenshtein distance by Rust
fn main() {
fn f(a:&str, b:&str) {
println!("{}:{} => {}", a, b, levenshtein_distance(a, b));
}
f("こんにちは", "こんばんは");
f("hello", "ell0");
f("hello", "hello");
f("こんにちは", "hello");
f("ABC", "ABC");
f("\u{1F369}", "\u{1F36A}");
@hideaki-t
hideaki-t / mmap_memoryview.ipynb
Created April 12, 2015 11:35
wrapping mmap object with memoryview
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hideaki-t
hideaki-t / normalize_neologd.py
Last active August 29, 2015 14:18
normalize_neologd.py
# encoding: utf8
from __future__ import unicode_literals
import re
import unicodedata
def unicode_normalize(cls, s):
pt = re.compile('([{}]+)'.format(cls))
def norm(c):
@hideaki-t
hideaki-t / send_to_kindle.py
Created July 4, 2014 05:12
send to kindle
import sys
from outbox import Outbox, Email, Attachment
from pathlib import Path
if sys.version_info.major < 3:
d = sys.getfilesystemencoding()
def u(s):
return unicode(s, d)
@hideaki-t
hideaki-t / unzip.py
Created May 18, 2014 07:34
unzipping a zip file with non-utf8 encoding by Python3
import zipfile
import sys
from pathlib import Path
def unzip(f, encoding, v):
with zipfile.ZipFile(f) as z:
for i in z.namelist():
n = Path(i.encode('cp437').decode(encoding))
if v: