Skip to content

Instantly share code, notes, and snippets.

yang wzyuliyang

Block or report user

Report or block wzyuliyang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wzyuliyang
wzyuliyang / nb.py
Created Mar 20, 2015
How To Implement Naive Bayes From Scratch in Python
View nb.py
# Example of Naive Bayes implemented from Scratch in Python
#http://machinelearningmastery.com/naive-bayes-classifier-scratch-python/
import csv
import random
import math
def loadCsv(filename):
lines = csv.reader(open(filename, "rb"))
dataset = list(lines)
for i in range(len(dataset)):
@wzyuliyang
wzyuliyang / recieveimageserver.cpp
Created Dec 24, 2014
boost+opencv 服务器端和客户端传输jpeg压缩的图像 (Mat表示)
View recieveimageserver.cpp
/*
* 使用了boost.asio 传输 opencv 获取的webcam 图像,传输的图像经过jpg压缩,传输的字节数大约为34000
* 是原来 240*320*3 的1/6 速度更加快了。
*
* yuliyang@qq.com
*
* 2014/10/21
*
* @copyright yuliyang@qq.com
*
@wzyuliyang
wzyuliyang / flask-post-image-server.py
Created Mar 30, 2015
qt post image to flask server
View flask-post-image-server.py
# ---templates
# uploads
# app.py
import os
# We'll render HTML templates and access data sent by POST using the
# request object from flask. Redirect and url_for will be used to
# redirect the user once the upload is done and send_from_directory will
# help us to send/show on the browser the file that the user just
# uploaded
View swift-python-delete-bucket.py
# coding=utf-8
import requests
from requests_toolbelt.utils import dump
host = '192.168.10.147:8081'
cmd = '/auth/1.0'
url = 'http://%s%s' % (host,cmd)
user = 'yuliyang:swift'
key = '65axGyxsx9kQPLiUlUb6hax7D7uEA90tTm1yaCmi'
headers = {'x-auth-key':key,'x-auth-user':user}
response = requests.get(url,headers=headers)
View swift-python-ceph.py
# # coding=utf-8
# import requests
# from requests_toolbelt.utils import dump
# host = '10.254.3.68:7480'
# cmd = '/auth/1.0'
# url = 'http://%s%s' % (host,cmd)
# user = 'yuliyang:yuliyang'
# key = 'OssHz2Ga1rrb49sYTAS5bih8VKWnZhxQlJDC2m48'
# user = 'testuser:testuser'
# key = 'NxPBANyfYVYwvQXQHfRrsi8lBn81dRHAm3S9C3Nj'
@wzyuliyang
wzyuliyang / github_repo.py
Created Nov 7, 2016 — forked from toast38coza/github_repo.py
An Ansible module for managing github repos
View github_repo.py
#!/usr/bin/python
DOCUMENTATION = '''
---
module: github_repo
short_description: Manage your repos on Github
'''
EXAMPLES = '''
- name: Create a github Repo
View install-instance.sh
# script instance
echo 172.23.113.5 vod-rpm >> /etc/hosts
sed -i 's/name=/enabled=0\nname=/g' /etc/yum.repos.d/*.repo
#add repo
cat << EOF > /etc/yum.repos.d/vod-centos6.repo
[VodCentos6-Repository]
name=Vod Centos6 - Local
baseurl=http://vod-rpm/centos6/Packages
@wzyuliyang
wzyuliyang / upload_5T_object.py
Created Dec 20, 2016
使用分块上传上传5T大文件
View upload_5T_object.py
# -*- coding: UTF-8 -*-
import requests
import xmltodict
from xmltodict import OrderedDict
from awsauth import S3Auth
from multiprocessing.dummy import Pool as ThreadPool
host = '192.168.10.201:7480'
access_key = 'user1'
secret_key = 'user1'
@wzyuliyang
wzyuliyang / install-opencv-mac.sh
Last active Aug 10, 2018
Installing OpenCV 2.4.9 on Mac OSX with Python Support
View install-opencv-mac.sh
brew tap homebrew/science
brew info opencv
brew install opencv
brew install opencv --with-ffmpeg //写视频文件
cd /usr/local/Cellar/opencv/2.4.9/
#Setting up Python
cat ~/.bash_profile | grep PYTHONPATH
cd /Library/Python/2.7/site-packages/
ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv2.so cv2.so
View V2EX自动领取每日签到登录奖励.js
// ==UserScript==
// @name V2EX自动领取每日签到登录奖励
// @namespace https://github.com/darknessomi/V2EX-Auto-check-in
// @description 每天打开V2EX网站任意页面时自动领取签到的登陆奖励。
// @updateURL https://raw.githubusercontent.com/darknessomi/V2EX-Auto-check-in/master/checkin.meta.js
// @downloadURL https://raw.githubusercontent.com/darknessomi/V2EX-Auto-check-in/master/checkin.user.js
// @icon http://www.v2ex.com/static/apple-touch-icon.png
// @author darknessomi
// @grant none
// @include http*://*.v2ex.com/*
You can’t perform that action at this time.