Skip to content

Instantly share code, notes, and snippets.

View wixb50's full-sized avatar
🎯
Focusing

wixb50 wixb50

🎯
Focusing
View GitHub Profile
@wixb50
wixb50 / make_cert.md
Last active July 21, 2022 00:48 — forked from liuguangw/make_cert.md
使用openssl制作自定义CA、自签名ssl证书

自签名ssl证书生成

生成CA私钥

# 创建文件夹 ca 保存Ca相关
mkdir ca
cd ca
#创建私钥 (建议设置密码)
openssl genrsa -des3 -out myCA.key 2048
@wixb50
wixb50 / db_compare.py
Created September 27, 2020 05:11
This simple script allows to easily compare the scheme of two different MySQL database.
#!/usr/bin/python
# -*- coding: utf-8 -*-
""" This script checks compares two databases schemas, first display
which tables are only present in the reference schema.
Then for each tables which are in the reference database it displays if
the attributes and (primary and foreign) which are differents.
"""
import sys
@wixb50
wixb50 / zerorpc_thread_client.py
Created January 25, 2018 02:13
zerorpc thread friendly client.
# -*- coding: utf-8 -*-
# @Author: xiewenqian <int>
# @Date: 2016-09-12T09:13:01+08:00
# @Email: wixb50@gmail.com
# @Last modified by: int
# @Last modified time: 2016-09-22T10:24:14+08:00
import os
import zmq
@wixb50
wixb50 / git2svn.sh
Created November 1, 2017 08:29
git2svn commit.
#!/bin/bash
BASE_DIR=`pwd`
GIT_DIR="/Users/gc/Temp/git_repo"
SVN_DIR="/Users/gc/Temp/svn_repo"
# The SVN_AUTH variable can be used in case you need credentials to commit
#SVN_AUTH="--username guilherme.chapiewski@gmail.com --password XPTO"
SVN_AUTH=""
function svn_checkin {

Python Socket 编程详细介绍

Python 提供了两个基本的 socket 模块:

  • Socket 它提供了标准的BSD Socket API。
  • SocketServer 它提供了服务器重心,可以简化网络服务器的开发。

下面讲解下 Socket模块功能。

Socket 类型

@wixb50
wixb50 / bash.md
Last active January 24, 2017 12:20
bash使用tips
  • 为所有指定文件加Header
header='/*\n *  Copyright (c) 2015 by MyCompany, Inc.\n *  All rights reserved.\n */\n'
find ~/my-proj/*.sh -exec sed -i "1s|^|$header|" {} \;
  • linux运行windows的bash文件'\r'问题
@wixb50
wixb50 / tornado-timeout.py
Created December 2, 2016 07:59
"timeout” a Request in Tornado.
import time
import contextlib
from tornado.ioloop import IOLoop
import tornado.web
from tornado import gen
@gen.coroutine
def async_sleep(timeout):
yield gen.Task(IOLoop.instance().add_timeout, time.time() + timeout)
@wixb50
wixb50 / mongo_to_csv.py
Last active March 2, 2021 19:16
python mongo to csv use pandas.
# @Author: xiewenqian <int>
# @Date: 2016-11-28T20:35:09+08:00
# @Email: wixb50@gmail.com
# @Last modified by: int
# @Last modified time: 2016-12-01T19:32:48+08:00
import pandas as pd
from pymongo import MongoClient
K=`curl -s http://www.symmz.com/sitemap_baidu.xml | ack -o 'http://www.symmz.com/\w+/\d+-\d+.html'`
for item in `echo $K`;do
ack -o 'http://img.symmz.com/images/\w+/\d{8}/\w+.jpg' html/`cd html && curl -s "$item" -O -w '%{filename_effective}' ` | xargs -L 1 bash -cx 'cd jpg && wget -c $0'
done
@wixb50
wixb50 / tmux.md
Created August 2, 2016 11:52 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a