Skip to content

Instantly share code, notes, and snippets.

@aristotll
aristotll / mecab-python-0.996-win32.diff
Last active August 29, 2015 14:26 — forked from vabock/mecab-python-0.996-win32.diff
mecab-0.996.exeを用いてmecab-python-0.996をビルドするためのパッチ
diff --git a/MeCab.py b/MeCab.py
index d24acba..a85d135 100644
--- a/MeCab.py
+++ b/MeCab.py
@@ -226,7 +226,6 @@ class Lattice(_object):
def feature_constraint(self, *args): return _MeCab.Lattice_feature_constraint(self, *args)
def set_boundary_constraint(self, *args): return _MeCab.Lattice_set_boundary_constraint(self, *args)
def set_feature_constraint(self, *args): return _MeCab.Lattice_set_feature_constraint(self, *args)
- def set_result(self, *args): return _MeCab.Lattice_set_result(self, *args)
def what(self): return _MeCab.Lattice_what(self)
@aristotll
aristotll / markdown_furigana.py
Created December 12, 2015 12:54 — forked from huangziwei/markdown_furigana.py
a python script for writing furigana in markdown
import fileinput
import re
import sys
```
eg. [東京]{とうきょう} -> <ruby>東京<rp>(</rp><rt>とうきょう</rt><rp>)</rp></ruby>
```
for line in fileinput.input(sys.argv[1:], inplace=True):
line = re.sub(r'\[(.*?)\]\{(.*?)\}', r'<ruby>\1<rp>(</rp><rt>\2</rt><rp>)</rp></ruby>', line.rstrip())
print(line)
@aristotll
aristotll / katakana_variants.txt
Created December 13, 2015 02:17 — forked from msmhrt/katakana_variants.txt
Katakana word list for pydocja/py33 (2013/01/03)
アイデア(19)、アイディア(1)
アクセサ(8)、アクセッサ(1)
アドレスファミリ(16)、アドレスファミリー(3)
アプリケーションコード(5)、アプリケーション・コード(1)
アポストロフィ(2)、アポストロフィー(1)
アンインストーラー(2)、アンインストーラ(1)
アンダフロー(2)、アンダーフロー(1)
アーカイバ(4)、アーカイバー(2)
アーカイブメンバ(6)、アーカイブメンバー(3)
イベントハンドラ(4)、イベント・ハンドラ(1)
@aristotll
aristotll / uninstall_7zip.py
Created December 17, 2015 05:37 — forked from vasily-v-ryabov/uninstall_7zip.py
Uninstall script for 7zip 9.20 (64-bit) - this is just an example
# Requirements:
# - Win7 or Win8.1 x64, 64-bit Python
# - pywinauto 0.5.2+
# - UAC is fully disabled
from __future__ import print_function
import pywinauto
pywinauto.Application().Start(r'explorer.exe')
explorer = pywinauto.Application().Connect(path='explorer.exe')
@aristotll
aristotll / install_7zip.py
Created December 17, 2015 05:37 — forked from vasily-v-ryabov/install_7zip.py
Install script for 7zip 9.20 (64-bit)
# Requirements:
# - Win7 or Win8.1 x64, 64-bit Python
# - pywinauto 0.5.2+
# - 7z920-x64.msi is in the same folder as the script
# - UAC is fully disabled
from __future__ import print_function
import sys, os
os.chdir(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0])))
import pywinauto
@aristotll
aristotll / kana_to_romaji.py
Created January 9, 2016 07:09 — forked from osima/kana_to_romaji.py
convert from kana(hiragana japanese character) to romaji using python
//
def kana_to_romaji(text):
dict={
u'あ':'a',u'い':'i',u'う':'u',u'え':'e',u'お':'o',
u'か':'ka',u'き':'ki',u'く':'ku',u'け':'ke',u'こ':'ko',
u'さ':'sa',u'し':'si',u'す':'su',u'せ':'se',u'そ':'so',
u'た':'ta',u'ち':'ti',u'つ':'tu',u'て':'te',u'と':'to',
@aristotll
aristotll / dde_client.py
Created January 9, 2016 14:57 — forked from noisywiz/dde_client.py
DDE Client
## {{{ http://code.activestate.com/recipes/577654/ (r1)
#!/usr/bin/env python
# Send DDE Execute command to running program
import time
from ctypes import POINTER, WINFUNCTYPE, c_char_p, c_void_p, c_int, c_ulong, c_char_p
from ctypes.wintypes import BOOL, DWORD, BYTE, INT, LPCWSTR, UINT, ULONG
# DECLARE_HANDLE(name) typedef void *name;
HCONV = c_void_p # = DECLARE_HANDLE(HCONV)
HDDEDATA = c_void_p # = DECLARE_HANDLE(HDDEDATA)
@aristotll
aristotll / pipelines.py
Created January 20, 2016 04:05 — forked from tzermias/pipelines.py
Scrapy MySQL pipeline. Just a mirror to the asynchronous MySQL pipeline. Copy-paste it directly to pipelines.py. Database credentials are stored in settings.py. Based on http://snipplr.com/view/66986/
import MySQLdb.cursors
from twisted.enterprise import adbapi
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from scrapy.utils.project import get_project_settings
from scrapy import log
SETTINGS = get_project_settings()
@aristotll
aristotll / PDFAnnotations.java
Created April 9, 2016 15:25 — forked from i000313/PDFAnnotations.java
Java: Class to get PDF annotations using the itextpdf lib. #java, #pdf, #annotations, #pdf-annotations, #itextpdf
package com.itextpdf;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfArray;
import com.itextpdf.text.pdf.PdfDictionary;
import com.itextpdf.text.pdf.PdfName;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfString;
import com.itextpdf.text.pdf.parser.FilteredTextRenderListener;
import com.itextpdf.text.pdf.parser.LocationTextExtractionStrategy;
@aristotll
aristotll / pyside_dynamic.py
Created April 16, 2016 02:23 — forked from cpbotha/pyside_dynamic.py
pyside_dynamic.py with minor improvements - also see http://stackoverflow.com/a/14894550/532513
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Sebastian Wiesner <lunaryorn@gmail.com>
# Modifications by Charl Botha <cpbotha@vxlabs.com>
# * customWidgets support (registerCustomWidget() causes segfault in
# pyside 1.1.2 on Ubuntu 12.04 x86_64)
# * workingDirectory support in loadUi
# found this here:
# https://github.com/lunaryorn/snippets/blob/master/qt4/designer/pyside_dynamic.py