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
#!/usr/bin/env python2.6 | |
# -*- mode: python coding: utf-8 -*- | |
"""Look up words from JP/EN Dictionary of Eijiro on the WEB | |
Third party libs: | |
- `httplib2` | |
- `pyquery` | |
- `lxml`: required by pyquery | |
""" | |
from optparse import OptionParser |
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
# /etc/X11/xorg.conf for virtualbox guest ubuntu lucid x86/amd64 | |
Section "Device" | |
Identifier "VirtualBox Video Card" | |
Driver "vboxvideo" | |
EndSection | |
Section "InputDevice" | |
Identifier "VBoxMouse" | |
Driver "vboxmouse" | |
Option "CorePointer" |
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
def import_as(module_name, globals_): | |
"""__import__ for relative module style. | |
usage: | |
mod = import_as("..templates.jinja2", globals()) | |
# it is same as: import ..templates.jinja2 as mod | |
""" | |
level = 0 | |
for ch in module_name: | |
if ch != ".": break | |
level += 1 |
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
;;; Make fixed TAB indent level for python mode | |
(add-hook | |
'python-mode-hook | |
'(lambda () | |
(defun my-indent-line (&optional arg) | |
"modeless indent for python indentation" | |
(interactive "P") | |
(let ((old-this-command this-command)) | |
(setq this-command t) | |
(cond |
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
"""ls2ts: list of list to trees | |
>>> tree = ls2ts([["a", "b", "c"], | |
... ["a", "c"]]) | |
>>> result = [tn("a", [tn("b", [tn("c", [])]), | |
... tn("c", [])])] | |
>>> tree == result | |
True | |
""" |
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
using Microsoft.Win32; | |
using System.Collections.Generic; | |
// set CapsLock key to send RCtrl code for Windows7 | |
// usage: execute this as Administrator, then log-off | |
class Caps2RCtrl { | |
static void Main(string[] args) { | |
List<byte> bytes = new List<byte>(); | |
bytes.AddRange(System.BitConverter.GetBytes(0)); // alwats 0 | |
bytes.AddRange(System.BitConverter.GetBytes(0)); // always 0 |
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
"""HTML5 microdata parser for python 2.x/3.x | |
- it requires lxml | |
- microdata specification: http://dev.w3.org/html5/md/ | |
""" | |
try: from urllib.parse import urljoin | |
except: from urlparse import urljoin | |
import lxml.html as lhtml | |
def items(html, types=None, uri=""): |
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
// Print MathML clipboard data from Windows7 accessory "Math Input Panel" | |
// compile: csc MathMLClip.cs | |
// usage: run the command after pressed "Insert" button on MIP | |
using System; | |
//using System.Diagnostics; | |
using System.IO; | |
using System.Text; | |
using System.Windows.Forms; | |
using System.Xml; |
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
diff -urN dblatex-0.3/lib/dbtexmf/dblatex/grubber/index.py dblatex-0.3-win32/lib/dbtexmf/dblatex/grubber/index.py | |
--- dblatex-0.3/lib/dbtexmf/dblatex/grubber/index.py 2010-04-05 09:07:53.000000000 +0900 | |
+++ dblatex-0.3-win32/lib/dbtexmf/dblatex/grubber/index.py 2010-11-07 18:20:08.084692400 +0900 | |
@@ -114,14 +114,16 @@ | |
msg.progress(_("processing index %s") % self.source) | |
if self.tool == "makeindex": | |
- cmd = ["makeindex", "-o", self.target] + self.opts | |
- cmd.extend(["-t", self.transcript]) | |
+ cwd = dirname(self.target) |