Skip to content

Instantly share code, notes, and snippets.

View mcchae's full-sized avatar

Jerry Chae mcchae

View GitHub Profile
@mcchae
mcchae / sch_class.py
Created August 22, 2016 10:40
APScheduler 3.2.0 example with Python 3.5
#!/usr/bin/env python3
from datetime import datetime
from time import sleep
from apscheduler.schedulers.background import BackgroundScheduler as Scheduler
##########################################################################################
class APS(object):
#=====================================================================================
def __init__(self):
@mcchae
mcchae / class_test.py
Last active June 17, 2016 03:34
python logging exception stack
#!/usr/bin/env python
#coding=utf8
##########################################################################################
import traceback
##########################################################################################
class A:
def m1(self,a,b):
return a/b
@mcchae
mcchae / limit_test.py
Created June 14, 2016 10:16
python memory limit and persistent dict and list
#!/usr/bin/env python
#coding=utf8
##########################################################################################
import os
import sys
import psutil
import resource
import getopt
# from random import randint
@mcchae
mcchae / test_client.py
Created May 24, 2016 01:38
python xml-rpc
#!/usr/bin/env python
'''
@package test_client
@brief this module is for testing xmlrpc
Started : 2010/03/10
license: CQVista's NDA
@version: 1.0.0
@author: Moonchang Chae <mcchae@cqvista.com>
@mcchae
mcchae / limit_cachedmem.py
Created May 16, 2016 07:59
linux limit cached memory
#!/usr/bin/env python
#coding=utf8
#
# limit_cachedmem.py
# limit cached memory for executing program
#
##########################################################################################
import sys
from os import system
@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
@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 / build.sh
Created October 1, 2015 11:17
supervisor
#!/bin/bash
# next package does not valid supervisor : system starting problem
dpkg -l | egrep "\<supervisor\>" >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
sudo apt-get update
sudo apt-get install supervisor
fi
grep "\[inet_http_server\]" /etc/supervisor/supervisord.conf >/dev/null 2>/dev/null
if [ $? -ne 0 ];then
@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 / 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) $<