This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import socket | |
import sys | |
import errno | |
class Memcached(object): | |
def __init__(self, host, port, connect_timeout = 30): | |
self._host = host | |
self._port = port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* desc: yet another simple ANSI-C skip list implement | |
* | |
* author: c4pt0r <huangdongxu@gmail.com> | |
* date: 2012-10-1 | |
* | |
* */ | |
#include <stdio.h> | |
#include <memory.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding=utf-8 | |
import uuid | |
"""a simple work around for a multi-key dictionary""" | |
"""written by c4pt0r 2012-10-16 """ | |
class MultiDict(object): | |
def __init__(self): | |
self._key_map = {} | |
self._data = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import bisect | |
import zlib | |
import redis | |
class DHT(object): | |
# servers ---> [('name', 'ip:port'), ('name1', 'ip:port')] | |
def __init__(self, servers, replica = 128): | |
self._servers = servers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"encoding/json" | |
"flag" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#encoding=utf-8 | |
#!/usr/bin/env python | |
# Copyright (c) 2012 dongxu | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// threadsafe_observer.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <memory> | |
#include <vector> | |
#include <string> | |
#include <Windows.h> | |
#include <iostream> | |
#include <process.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
# json config parser | |
class JsonConfigParser(object): | |
def __init__(self, config_file): | |
self.fp = open(config_file) | |
self.raw_config_content = self.fp.read() | |
#print self.raw_config_content | |
self.config_value = json.loads(self.raw_config_content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### INSTALLATION NOTES ### | |
# 1. Install Homebrew (https://github.com/mxcl/homebrew) | |
# 2. brew install zsh | |
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh) | |
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace | |
# 5. Install iTerm2 | |
# 6. In iTerm2 preferences for your profile set: | |
# Character Encoding: Unicode (UTF-8) | |
# Report Terminal Type: xterm-256color | |
# 7. Put itunesartist and itunestrack into PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MainDlg.cpp : 实现文件 | |
// | |
#include "stdafx.h" | |
#include "float_main_window.h" | |
#include "manage_dlg.h" | |
#include "usb_connection_helper.h" | |
#include "miniwdj2_dlg.h" | |
#include "setting_dialog.h" |