Skip to content

Instantly share code, notes, and snippets.

View AlexYangYu's full-sized avatar

Alex Yang AlexYangYu

View GitHub Profile
@dorneanu
dorneanu / plugin_architecture.md
Last active October 16, 2024 15:07
Python: Implement basic plugin architecture with Python and importlib

Implementing a basic plugin architecture shouldn't be a complicated task. The solution described here is working but you still have to import every plugin (inheriting from the base class).

This is my solution:

Basic project structure

$ tree
@ajayhn
ajayhn / db_in_json.py
Last active August 10, 2016 06:38
db_in_json.py
# e.g pycassaShell -H <db-node-ip> -f db_in_json.py | sed -e '1,/contents:/d' | python -m json.tool
from pprint import pprint
import json
import kazoo.client
db_contents = {'cassandra': {},
'zookeeper': {}}
cassandra_contents = db_contents['cassandra']
for ks_name in ['config_db_uuid',
@jriguera
jriguera / 00_openstack_vmware.md
Last active February 5, 2019 13:52
OpenStack and VMware integration
@tsuna
tsuna / ScannerTest.java
Last active December 16, 2015 18:49 — forked from AlexYangYu/gist:5476160
Recursive asynchronous HBase scanning
package me.alexyang.scanner;
import java.nio.charset.Charset;
import java.util.ArrayList;
import org.jboss.netty.util.CharsetUtil;
import com.stumbleupon.async.Callback;
import com.stumbleupon.async.Deferred;
import org.hbase.async.HBaseClient;
@jelies
jelies / AutowiringSpringBeanJobFactory.java
Last active October 24, 2024 16:38
Quartz (2.1.6) java config with spring (3.2.1). Using a SpringBeanJobFactory to automatically autowire quartz classes.
package com.jelies.spring3tomcat7.config.quartz;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
/**
* This JobFactory autowires automatically the created quartz bean with spring @Autowired dependencies.