Skip to content

Instantly share code, notes, and snippets.

View Mavlarn's full-sized avatar

Mavlarn Mavlarn

  • Vantiq
View GitHub Profile
@Mavlarn
Mavlarn / about-me
Created March 11, 2014 16:09
about-me
# RESUME
## Personal Information
----
Name: Mavlarn. Tuohuti (买乌拉江)
Birthday: 1980
Gender: male
Phone: 13810957617
Email: mavlarn@163.com mavlarn@gmail.com
Nation: China
// just wrap 'filesizejs.com' as filter.
module
.filter('FileSize', function () {
return function (arg, descriptor) {
var si = {
bits : ["B", "kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"],
bytes : ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
};
# -*- 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 / 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