Skip to content

Instantly share code, notes, and snippets.

@jetgeng
jetgeng / PosCmdDispatchService.groovy
Last active December 20, 2015 14:19
动态绑定
package com.e6sh.beautiful.mind
import com.e6sh.beautiful.mind.cmd.POSCardQueryCommand
import org.codehaus.groovy.grails.web.metaclass.BindDynamicMethod
def bind = new BindDynamicMethod()
def cmd = new POSCardQueryCommand()
//cmd.properties = params
@jetgeng
jetgeng / logback.groovy
Last active December 18, 2015 01:28
使用groovy配置logback。 并加上过滤
import ch.qos.logback.core.FileAppender;
import ch.qos.logback.core.ConsoleAppender;
import org.gunn.spring.demo.AppContextFilter;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import static ch.qos.logback.classic.Level.DEBUG;
import static ch.qos.logback.classic.Level.INFO;
appender("FILE",FileAppender){
@jetgeng
jetgeng / Activator
Created December 12, 2012 03:25
replace osgi bundle class loader
package org.gunn.osgi.web.demo;
import java.lang.reflect.Field;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate;
import org.eclipse.osgi.framework.internal.core.BundleHost;
import org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader;
@jetgeng
jetgeng / gist:3905638
Created October 17, 2012 13:56
Generator pom.xml for tycho
'''
Created on Oct 17, 2012
@author: gengjet
'''
from mako.template import Template
import os
import re
@jetgeng
jetgeng / gist:3891325
Created October 15, 2012 08:07
Epser Pattern :and , timer
@Name('Select-Commit') @Audit
select a.* from pattern [ a=CommitEvent(userName='tom') and timer:at(0, 16, *, *, *) ]
@jetgeng
jetgeng / pre-commit
Created September 22, 2012 03:33 — forked from spulec/pre-commit
Yipit Pre-commit Hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@jetgeng
jetgeng / gist:3416459
Created August 21, 2012 15:19
pyaudio recoder from microphone
# -*- coding: utf-8 -*-
from pyaudio import PyAudio, paInt16
import numpy as np
from datetime import datetime
import wave
# 将data中的数据保存到名为filename的WAV文件中
def save_wave_file(filename, data):
wf = wave.open(filename, 'wb')
@jetgeng
jetgeng / gist:3375074
Created August 17, 2012 01:13
cv2 with wx
#!/usr/bin/env python
import wx
import cv2.cv as cv
class WebcamPlayback(wx.Panel):
TIMER_PLAY_ID = 101
def __init__(self, parent, id):
@jetgeng
jetgeng / gist:3335274
Created August 12, 2012 23:20
parser spring-dm
# -*- coding: utf-8 -*-
'''
Created on Aug 11, 2012
@author: gengjet
'''
from xml.sax import make_parser, handler