Skip to content

Instantly share code, notes, and snippets.

View jannson's full-sized avatar
💭
I may be slow to respond.

Jason jannson

💭
I may be slow to respond.
View GitHub Profile
# -*- coding=utf-8 -*-
import collections
# Usage:
# 我的做法是把WordsDetector.py里的结果输出到文件,
# 然后把文件名放到下面的names列表中,运行本程序。
names = ['name0',
'name1',
'name2',
import logging
from scipy.odr import models
import unittest
import os
import os.path
import tempfile
import numpy
import gensim
import logging
import logging
from sqlalchemy import create_engine, Table, Column, Integer, String, MetaData, ForeignKey
from sqlalchemy.orm import relation, mapper, sessionmaker
from sqlalchemy.sql import *
from sqlalchemy.ext.associationproxy import association_proxy
log = logging.getLogger('nm_test')
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s,%(msecs)03d %(levelname)s [%(filename)s.%(funcName)s @ %(lineno)d.%(thread)d] %(message)s')
@jannson
jannson / msr_trans.py
Last active August 29, 2015 13:56
translate msr_tranning.utf to crf++ template
#!/usr/bin/python
# -*- coding: utf-8 -*-
import codecs
import re
fout = codecs.open('fout.txt', 'w','utf-8')
accepted_chars = re.compile(ur"[\u4E00-\u9FA5]+", re.UNICODE)
en_chars = re.compile(ur"[a-zA-Z0-9]+", re.UNICODE)
B = ['B','B1','B2']+['M']*10
@jannson
jannson / qemu_ecos3.0.patch
Created March 12, 2014 03:51
更新eCos代码,以让eCos能运行在qemu mips上,并能进行网卡通信。
Index: packages/kernel/v3_0/src/intr/intr.cxx
===================================================================
--- packages/kernel/v3_0/src/intr/intr.cxx (revision 12)
+++ packages/kernel/v3_0/src/intr/intr.cxx (revision 24)
@@ -680,6 +680,10 @@
CYG_INTERRUPT_STATE old_ints;
HAL_DISABLE_INTERRUPTS(old_ints);
+ if (vector >= CYGNUM_HAL_INTERRUPT_CTRL1_BASE)
+ {
gcc -Wp,-MD,arch/x86/mm/.mmap.o.d -nostdinc -isystem /usr/lib/gcc/i686-redhat-linux/4.4.6/include -I/home/gan/project/xenomai_prj/linux-2.6.38.8/arch/x86/include -Iinclude -I/home/gan/project/xenomai_prj/linux-2.6.38.8/include -include include/generated/autoconf.h -I/home/gan/project/xenomai_prj/linux-2.6.38.8/arch/x86/mm -Iarch/x86/mm -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -m32 -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2 -march=i686 -mtune=generic -Wa,-mtune=generic32 -ffreestanding -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wframe-larger-than=2048 -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserv
#!/bin/sh
#./mipsel-softmmu/qemu-system-mipsel -bios ~/project/source/malta_le/examples/hello -S -s -nographic -net nic -net socket,udp=127.0.0.1:11110,localaddr=127.0.0.1:11210
#./mipsel-softmmu/qemu-system-mipsel -bios /home/gan/project/source/malta_le/examples/hello -S -s -nographic -net nic -net tap,ifname=tap1,script=no
#./mipsel-softmmu/qemu-system-mipsel -bios ~/project/source/malta_le/examples/hello -S -s -nographic -net nic -net socket,udp=127.0.0.1:11100,localaddr=127.0.0.1:21015
./mipsel-softmmu/qemu-system-mipsel -bios /home/gan/project/source/malta_le/examples/ping -S -s -nographic -net nic -net tap,ifname=tap1,script=no
./i386-softmmu/qemu-system-i386 -s -kernel /home/gan/project/xenomai_prj/buildroot-2012.08/output/build/linux-2.6.38.8/arch/x86/boot/bzImage -hda /home/gan/project/xenomai_prj/buildroot-2012.08/output/images/rootfs.ext2 -append "console=ttyS0 root=/dev/sda rw xeno_hal.clockfreq=1600000000 xeno_hal.cpufreq=1600000000" -nographic
./i386-softmmu/qemu-system-i386 -kernel ~/project/xenomai_prj/linux-2.6.38.8/build/arch/i386/boot/bzImage -hda ~/project/xenomai_prj/busybox-1.20.2/rootfs.img -append "console=ttyS0 root=/dev/sda xeno_hal.clockfreq=1600000000 xeno_hal.cpufreq=1600000000" -nographic
#!/bin/sh
RAMSIZE=32768
STRIP_DIR=rootfs-cpio
TEMP_DIR=ramfs_tempdir
dd if=/dev/zero of=initrd.img bs=1k count=$RAMSIZE
#/sbin/mke2fs -F -m0 initrd.img
/sbin/mkfs.ext2 -F -v -m0 initrd.img
mkdir $TEMP_DIR
mount -o loop,exec initrd.img $TEMP_DIR
/*
* The actual transition into protected mode
*/
#include <asm/boot.h>
#include <asm/processor-flags.h>
#include <asm/segment.h>
#include <linux/linkage.h>
.text
.code16
/*