Skip to content

Instantly share code, notes, and snippets.

View Mavlarn's full-sized avatar

Mavlarn Mavlarn

  • Vantiq
View GitHub Profile
# -*- coding:utf-8 -*-
# Database test.
#
from java.sql import DriverManager
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from cubrid.jdbc.driver import CUBRIDDriver
from java.util import Random
from java.lang import System
@Mavlarn
Mavlarn / BlockingSocketIO.java
Last active December 14, 2015 16:29
blocking socket io java client
package my;
import io.socket.IOAcknowledge;
import io.socket.IOCallback;
import io.socket.SocketIO;
import io.socket.SocketIOException;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
@Mavlarn
Mavlarn / test-socket.io-with-ngrinder.py
Last active December 14, 2015 18:49
Jython script to test socket.io server in nGrinder.
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from org.json import JSONObject
from my import BlockingSocketIO
test1 = Test(1, "Test1")
class TestRunner:
# -*- coding:utf-8 -*-
from io.socket import IOCallback
from java.util.concurrent.locks import ReentrantLock
from io.socket import SocketIO
# it use socket.io java client of: https://github.com/Gottox/socket.io-java-client
class BlockingSocketIO(IOCallback):
respMsg = "";
@Mavlarn
Mavlarn / VMMonitor.java
Created April 2, 2013 03:23
Monitor a VM process in current machine with JMX, attach API.
package my.test;
import java.io.File;
import java.io.IOException;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage;
import java.util.HashSet;
@Mavlarn
Mavlarn / zk_client.c
Last active December 22, 2015 04:58
Workable C client code for zookeeper ensemble.
/**
* Workable C client code for zookeeper ensemble under zoopiter management.
* Include async and sync mode, for async mode, should use some synchronization method like 'lock'.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <zookeeper/zookeeper.h>
@Mavlarn
Mavlarn / Git tutorial
Created November 29, 2013 05:37
git tutorial
# Git tutorial #
This tutorial will show you some basic usgae of git, including how to create a git repository, commit, push to local and remote repository. And also show you how to use with more than one remote repository,
## Working in local repository ##
-------
At first, we will create a git repository in our local and working on that. We will create a project with git and add/modify some files.
At first, create a repository:
```bash
@Mavlarn
Mavlarn / CreateJarFile.java
Created January 1, 2014 05:28
Create java package in code.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
public class CreateJarFile {
public static int BUFFER_SIZE = 10240;
protected void createJarArchive(File archiveFile, File[] tobeJared) {
;; LOAD ME WITH
;; (load-file "/home/john/hobby-code/require-all-snippet.clj")
;; This file conditions a repl in various ways that I do all the time.
;; Firstly we want to 'require' all the namespaces on the classpath
;; This ensures that find-doc and the like will work
(require 'clojure.contrib.find-namespaces)
;; Some namespaces may fail to load, so catch any exceptions thrown
@Mavlarn
Mavlarn / lt-cljs-tutorial.clj
Created January 20, 2014 12:14
An Introduction to ClojureScript for Light Table users Got from https://github.com/swannodette/lt-cljs-tutorial.
;; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;; An Introduction to ClojureScript for Light Table users
;; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;; Basics
;; ============================================================================
;; To begin open the command pane (type Control-SPACE), Add Connection, select
;; Light Table UI. Once connected you can evaluate all the forms in this file