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 / 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):
@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 / 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 / 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 / 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 / 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 / bank_account.erl
Last active November 13, 2017 10:54
erlang gen_server的使用:以银行账户服务为例
%%%-------------------------------------------------------------------
%%% @author Flowsnow
%%% @copyright (C) 2017, <COMPANY>
%%% @doc
%%% http://www.kongqingquan.com/archives/403
%%% @end
%%% Created : 13. 十一月 2017 17:19
%%%-------------------------------------------------------------------
-module(bank_account).
-author("Flowsnow").
@suncle1993
suncle1993 / curlPOST.md
Created November 16, 2017 11:01
curl post请求

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@suncle1993
suncle1993 / dets.erl
Created November 30, 2017 05:41
Erlang dets的使用:增删查遍历
Eshell V7.3 (abort with ^G)
1> dets:open_file(bbb, [{type, bag}]).
{ok,bbb}
2> dets:lookup(bbb, "b11").
[{"b11","b22","b32"},{"b11","b21","b31"}]
3>
3> dets:lookup(bbb, "a11").
[]
4>
4> dets:insert(bbb, {"b11", "b23", "b33"}).
@suncle1993
suncle1993 / sheet_merge.vb
Created December 13, 2017 06:35
将多个Excel workbook的同名称sheet页(比如sheet也名称为"其他流动资产")合并到一个workbook中
Sub HB()
'定义对话框变量
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'新建一个工作簿
Dim newwb As Workbook
Set newwb = ThisWorkbook