Skip to content

Instantly share code, notes, and snippets.

View mcchae's full-sized avatar

Jerry Chae mcchae

View GitHub Profile
@mcchae
mcchae / rest_api.py
Last active December 8, 2019 16:12
Flask REST API sample
#!/usr/bin/env python
#coding=utf8
##########################################################################################
import os
import logging
import logging.handlers
import traceback
from flask import Flask
from flask.ext.restful import reqparse, abort, Api, Resource
from flask import request
#!/usr/bin/env python
#coding=utf8
"""
====================================
:mod: pcap 파일을 읽어 IPv4의 Layer3 주소를 IPv6 주소로 변환
@참고 : http://comments.gmane.org/gmane.network.tcpreplay.user/1086
====================================
.. moduleauthor:: 채문창 <[email protected]>
.. note:: GNU License
@mcchae
mcchae / b_xmlrpc_server.py
Created December 18, 2014 02:32
Python non-blocking XML-RPC
#!/usr/bin/env python
#coding=utf8
"""
====================================
:mod: 테스트용 blocking XML-RPC 서버
====================================
.. moduleauthor:: 채문창 <[email protected]>
.. note:: GNU
설명
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 / api_client.py
Created April 15, 2015 01:20
Flask File Upload
##########################################################################################
import os
import sys
import json
import unittest
import pprint
import httplib
import urllib
import datetime
import random
@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 / memprofile.py
Last active August 12, 2020 08:10
Python guppy memory profiling
#!/usr/bin/env python
#coding=utf8
##########################################################################################
class HeapMon:
"""
guppy 모듈을 이용하여 메모리 Heap의 소모량을 구하는 클래스
.. note:: guppy 모듈 설치 방법
sudo apt-get install python-dev
sudo pip install guppy
@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
##########################################################################################