Skip to content

Instantly share code, notes, and snippets.

View mcchae's full-sized avatar

Jerry Chae mcchae

View GitHub Profile
#!/usr/bin/env python
#coding=utf8
"""
====================================
:mod: pcap 파일을 읽어 IPv4의 Layer3 주소를 IPv6 주소로 변환
@참고 : http://comments.gmane.org/gmane.network.tcpreplay.user/1086
====================================
.. moduleauthor:: 채문창 <mcchae@future.co.kr>
.. note:: GNU License
from ctypes import *
import os
mylib = cdll.LoadLibrary('%s/loopcheck.so' % os.getcwd())
res = mylib.loop(100000, 10000)
@mcchae
mcchae / echorecv.c
Created March 25, 2015 00:33
CyaSSL sample
/******************************************************************************************/
// echorecv.c
//
// receiving server sample using CyaSSL
/******************************************************************************************/
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
@mcchae
mcchae / udt_client.cpp
Created May 7, 2015 15:59
Reliable UDP library - UDT sample code
#include <cstdlib>
#include <cstring>
#include <netdb.h>
#include <iostream>
#include <udt.h>
#include <stdio.h>
#include <time.h>
#include <stdarg.h>
#include <sys/types.h>
#include <unistd.h>
@mcchae
mcchae / build.sh
Created June 17, 2015 07:08
diagpy : Simple Python dialog based Text UI
#!/bin/bash
# for ubuntu 12.04 LTS
sudo apt-get install dialog
sudo -H pip install python2-pythondialog
## for CentOS 5.4 386
#sudo yum install dialog
#sudo -H /opt/bin/pip install python2-pythondialog
## If above pip fail with next message
@mcchae
mcchae / dict_str.py
Created September 4, 2015 05:57
python serialization : dict <=> str
#!/usr/bin/env python
#coding=utf8
##########################################################################################
from datetime import datetime
import cPickle
import marshal
import msgpack
##########################################################################################
@mcchae
mcchae / Makefile
Last active September 9, 2015 05:26
udp queue test
INC=-Iinc/
CC=gcc
DEBUG=-g
all: out/libfuq.a out/udp_send out/udp_recv_file out/udp_recv
out/udp_send.o: src/udp_send.c
$(CC) -o $@ $(DEBUG) -c $(INC) $<
out/udp_recv_file.o: src/udp_recv_file.c
$(CC) -o $@ $(DEBUG) -c $(INC) $<
@mcchae
mcchae / redissess.py
Last active September 15, 2015 10:53
FlaskRedisSession
from uuid import uuid4
from datetime import datetime, timedelta
from flask.sessions import SessionInterface, SessionMixin
from werkzeug.datastructures import CallbackDict
from flask import Flask, session, url_for, redirect
import redis
import cPickle
@mcchae
mcchae / exclude_header.sh
Created October 7, 2015 06:40
exclude header lines
#!/bin/bash
usage()
{
echo "usage: $0 <folder> <matching_string> <n>"
echo " extract all first n header files from a file which is matching matching_string"
echo " ex) $0 . 'matching string' 15"
}
if [ $# -ne 3 ];then
@mcchae
mcchae / lru_map.cpp
Created October 14, 2015 12:23
LRU_Map
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <map>
#include <string>
//========================================================================================
//========================================================================================
#define MAX_LRU_MAP 3