Skip to content

Instantly share code, notes, and snippets.

View suncle1993's full-sized avatar
🎯
Focusing

Suncle Chen suncle1993

🎯
Focusing
View GitHub Profile
@suncle1993
suncle1993 / Mixer.py
Created November 13, 2017 06:08
Python MixIn的使用
class Base(object):
"""Base class for mixer classes. All mixin classes
require the classes they are mixed in with to be
instances of this class (or a subclass)."""
def __init__(self,b):
self.b = b # Mixin classes assume this attribute will be present
class MixinBPlusOne(object):
"""A mixin class that implements the print_b_plus_one
@suncle1993
suncle1993 / tail_call_optimized.py
Created November 13, 2017 06:07
python尾递归装饰器及使用
# coding=utf-8
import sys
class TailRecurseException:
def __init__(self, args, kwargs):
self.args = args
self.kwargs = kwargs
def tail_call_optimized(g):
"""
@suncle1993
suncle1993 / wslog_query_client.sh
Created November 13, 2017 06:02
网宿日志列表接口查询脚本
#!/bin/sh
TMP_FILE="/tmp/wslog_query_client.log"
#Usage
Usage() {
echo "wslog_query_client.sh [query_url] [user] [passwd] [start_time] [end_time] [channels]"
return 0
}
#check input parameters
if [ $# -eq 1 ]; then
@suncle1993
suncle1993 / twocamsvideostitching.cpp
Created November 13, 2017 05:55
两个摄像头视频拼接
#include "twocamsvideostitching.h"
#include "ui_twocamsvideostitching.h"
twoCamsVideoStitching::twoCamsVideoStitching(QWidget *parent) :
QWidget(parent),
ui(new Ui::twoCamsVideoStitching)
{
ui->setupUi(this);
}
@suncle1993
suncle1993 / pyplot_draw_two_lines.py
Last active November 13, 2017 05:50
pyplot在一个图中画多条线的方式
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import matplotlib
# matplotlib.use('Agg')
import numpy as np
@suncle1993
suncle1993 / TcpChatServer.py
Created April 25, 2017 05:52
Python TCP聊天室服务端
import socket
import threading
class TcpChatServer:
def __init__(self, ip='192.168.110.13', port=9001):
self.ip = ip
self.port = port
self.clients = {}
self.sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM)
self.event = threading.Event()
def recv(self, so, ip ,port):