Skip to content

Instantly share code, notes, and snippets.

@hktechn0
hktechn0 / usb_wsim-pathch.diff
Created December 13, 2009 12:52
kernel module patch for IODATA USB-WSIM
diff -ur linux-source-2.6.30/drivers/usb/serial/pl2303.c linux-source-2.6.30-mod/drivers/usb/serial/pl2303.c
--- linux-source-2.6.30/drivers/usb/serial/pl2303.c 2009-12-04 07:22:40.000000000 +0900
+++ linux-source-2.6.30-mod/drivers/usb/serial/pl2303.c 2009-12-12 00:10:37.000000000 +0900
@@ -60,6 +60,7 @@
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_GPRS) },
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
+ { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_UWSIM) },
{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
@hktechn0
hktechn0 / ascii.c
Created December 13, 2009 18:32
print all printable ascii chars
#include <stdio.h>
int main(void)
{
int i;
for(i = 0x20; i < 0x7f; i++) {
printf("%c", i);
}
printf("\n");
#!/usr/bin/env python
import datetime
loop = 500000
a = str()
s = datetime.datetime.now()
for i in range(loop):
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/lib64/xorg/modules"
FontPath "catalogue:/etc/X11/fontpath.d"
@hktechn0
hktechn0 / pil_image_urllib2.py
Created February 5, 2010 20:44
PIL Image get from web (urllib2)
#!/usr/bin/env python
import urllib2
import Image
import cStringIO
imgdata = urllib2.urlopen("http://www.google.co.jp/intl/ja_jp/images/logo.gif").read()
img = Image.open(cStringIO.StringIO(imgdata))
img.save("goog.png")
#!/usr/bin/env python
import threading
import time
class test(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.i = 0
#!/usr/bin/env python
import threading
import time
class test(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.setDaemon(True)
self.i = 0
#!/usr/bin/env python
def test():
print "Hello."
return True
a = {10 : "0x1010"}
# k in a
print a.get(10, test()) # :True
print a.get(100, test()) # :False
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import curses
import locale
def test(stdcur):
stdcur.clear()
stdcur.addstr(0, 0, "abcde")
stdcur.addstr(1, 0, "あいうえお")
@hktechn0
hktechn0 / htmltitle.py
Created February 18, 2010 20:32
pick out title from HTML
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import urllib2
import HTMLParser
html = urllib2.urlopen(sys.argv[1]).read()
class titleparser(HTMLParser.HTMLParser):