Skip to content

Instantly share code, notes, and snippets.

@hideaki-t
hideaki-t / nvblas.md
Last active December 14, 2022 03:43
@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:
@hideaki-t
hideaki-t / CSVParser.java
Created July 9, 2013 05:13
regex based CSV parser in Java(without newline support)
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CSVParser {
private static final Pattern p = Pattern.compile(",|[^,\"]+|\"(?:[^\"]|\"\")*\"");
public static List<String> parse(final String line, final int max) {
if (max == 0) {
@hideaki-t
hideaki-t / sqlite_fts_tokenizer.py
Created August 18, 2012 20:59
a proof of concept implementation of SQLite FTS tokenizers in Python
# coding: utf-8
"""
a proof of concept implementation of SQLite FTS tokenizers in Python
"""
from __future__ import print_function, unicode_literals
import sys
import ctypes
from ctypes import POINTER, CFUNCTYPE
import struct
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
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 <schnouki@schnouki.net>
# Contributor: Andreas Radke <andyrtr@archlinux.org>
# Contributor: Art Gramlich <art@gramlich-net.com>
pkgname=icu52
_pkgname=icu
pkgver=52.1
pkgrel=1
pkgdesc="International Components for Unicode library"
arch=(i686 x86_64)
@hideaki-t
hideaki-t / init.html
Last active December 27, 2015 03:29
to test adding entries into an array for a ng-repeat-ed element
<select class="ng-pristine ng-valid" ng-options="e.name for e in entries" ng-model="entry">
<option value="0" selected="selected">
default
</option>
</select>
import sys
try:
from PySide import QtCore
from PySide import QtGui
from PySide import QtWebKit
except:
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4 import QtWebKit