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
# dummy_httpd.py | |
# based on python 2.7 | |
import BaseHTTPServer | |
from BaseHTTPServer import BaseHTTPRequestHandler | |
from SocketServer import ThreadingMixIn | |
import threading | |
import time | |
class ThreadedHTTPServer(ThreadingMixIn, BaseHTTPServer.HTTPServer): | |
daemon_threads = True |
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 test | |
import com.sun.jna._ | |
import com.sun.jna.ptr._ | |
trait Kernel32 extends Library { | |
def GetDiskFreeSpaceA(lpRootPathName: String, | |
lpSectorsPerCluster: IntByReference, lpBytesPerSector: IntByReference, | |
lpNumberOfFreeClusters: IntByReference, lpTotalNumberOfClusters: IntByReference): Boolean | |
def GetComputerNameW(outName: Array[Char], size: IntByReference): Boolean |
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
#include "thread_id_pool.h" | |
#include <pthread.h> | |
#include <assert.h> | |
static pthread_key_t s_tkey; | |
static pthread_once_t s_tkey_once; | |
static void freeKey(void *p) | |
{ | |
ThreadIdPool::TVal *val = (ThreadIdPool::TVal*) p; |
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
#!/usr/bin/env ruby | |
# | |
# I write this script to post my personl blog codemacro.com posts to my cppblog.com/kevinlynx | |
# Kevin Lynx 8.7.2012 | |
# | |
require 'nokogiri' | |
require 'open-uri' | |
require 'xmlrpc/client' | |
require 'yaml' |
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
#include <assert.h> | |
#include <vector> | |
#include <map> | |
class DecisionStmt { | |
public: | |
enum { DECISION_RET = (unsigned) -1 }; | |
typedef std::map<unsigned, int> CondResult; | |
typedef std::vector<CondResult> AccResults; | |
typedef std::vector<unsigned> CondList; |
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
/* | |
* http://www.bittorrent.org/beps/bep_0010.html | |
* http://www.bittorrent.org/beps/bep_0009.html | |
*/ | |
package bep.impl | |
import java.io._ | |
import io.netty.channel.ChannelHandlerContext | |
import io.netty.channel.ChannelInboundHandlerAdapter | |
import io.netty.buffer._ |
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
/* | |
* http://www.bittorrent.org/beps/bep_0010.html | |
* http://www.bittorrent.org/beps/bep_0009.html | |
*/ | |
package netty.sample | |
import io.netty.channel.ChannelHandlerContext | |
import io.netty.channel.ChannelInboundHandlerAdapter | |
import io.netty.buffer.ByteBuf | |
import io.netty.bootstrap.Bootstrap |
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
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <algorithm> | |
class A | |
{ | |
}; | |
class B |
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
// e.g: copyDir("folder\\", "destFolder\\", false); | |
bool copyDir(const char *r_szSrcPath, const char *r_szDesPath, bool recur) { | |
WIN32_FIND_DATA FindFileData; | |
HANDLE hFind; | |
char l_szTmp[MAX_PATH]; | |
strcpy(l_szTmp, r_szSrcPath); | |
char l_szSrcPath[MAX_PATH]; | |
char l_szDesPath[MAX_PATH]; | |
strcpy(l_szSrcPath, r_szSrcPath); |
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 netty.sample | |
import io.netty.channel.ChannelHandlerContext | |
import io.netty.channel.ChannelInboundHandlerAdapter | |
import io.netty.buffer.ByteBuf | |
import io.netty.bootstrap.Bootstrap | |
import io.netty.channel._ | |
import io.netty.channel.nio._ | |
import io.netty.channel.socket._ | |
import io.netty.channel.socket.nio._ |
NewerOlder