Skip to content

Instantly share code, notes, and snippets.

YouQingKui youqingkui

Block or report user

Report or block youqingkui

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
@youqingkui
youqingkui / python
Created Jul 5, 2018 — forked from 582033/python
树莓派获取[cpu温度/cpu使用率/内存空闲率]
View python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
显示树莓派cpu温度、使用率及内存使用率
'''
import os
def show_temp():
file = open("/sys/class/thermal/thermal_zone0/temp")
View gist:b4f88e3b607ed5e3239e645ef0a4dfac
import cv2
import urllib
import numpy as np
stream=urllib.urlopen('http://192.168.31.249:8080/video')
bytes=''
while True:
bytes+=stream.read(1024)
a = bytes.find('\xff\xd8')
b = bytes.find('\xff\xd9')
@youqingkui
youqingkui / log_test11.py
Created Jan 16, 2018 — forked from anonymous/log_test11.py
Test script showing usage of a buffering SMTP handler.
View log_test11.py
#!/usr/bin/env python
#
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of Vinay Sajip
# not be used in advertising or publicity pertaining to distribution
@youqingkui
youqingkui / centos_python.sh
Created Mar 24, 2017 — forked from selfboot/centos_python.sh
CentOS 6.8: Install Python 2.7.10, pip, virtualenv, and virtualenvwrapper on CentOS
View centos_python.sh
#!/bin/bash
# According to:
# How To Set Up Python 2.7.6 and 3.3.3 on CentOS 6.4
# https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4
yum -y update
yum groupinstall -y 'development tools'
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
yum install xz-libs
wget http://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
View gist:dec78f51330b4bc120c3a5ab635f2dd2
2017年3月16日 by Ron
我是来自AWS 广东社区微信2群的Ron.第一次去参加AWS分享会的时候,第一个上来的就是关于Lambda的.但当时我听完后.
觉得这东西耦合度太高,不好.就一直没在去深入了解.那一次技术分享会,还有卓动--张穗文先生分享的Kinesis + RedShift做
用户日志分析,和有米科技的实时日志分析,那个时候真的感叹跟AWS相见恨晚.他们两分享的东西都非常棒,直接驱使我来后自己
去尝试开发Kinesis,SQS等.总体来说,AWS组件很多.但我毕竟刚接触没多久,所以很多AWS的组件和相关概念都还很陌生,
或者说根本就不知道是什么东西.以下在阐释的时候,如有偏差或者错误,欢迎拍砖(我Email: luodm03@qq.com)
在这过去的半年多时间里.所有广州社区的分享会,我都去了.最近一次正好听到胖虎的Lambda的分享会.
回来的路上我已经满脑子的开始想我最近的在做的一个东西,是否能用Lambda来实现.
@youqingkui
youqingkui / tree.md
Created Nov 22, 2016 — forked from upsuper/tree.md
一行 Python 实现树
View tree.md

一行 Python 实现树

使用 Python 内置的 defaultdict,我们可以很容易的定义一个树形数据结构:

def tree(): return defaultdict(tree)

就是这样!

View gevent-multil-process.py
#encoding=utf-8
'''
演示如何多进程的使用gevent,
1、gevent和multiprocessing组合使用会有很多问题,
所以多进程直接用subprocess.Popen,进程间不通过fork共享
任何数据,完全独立运行,并通过socket通信
2、进程间同步不能用multiprocessing.Event,
因为wait()的时候会阻塞住线程,其它协程的代码无法执行,也
不能使用gevent.event.Event(),因为它通过multiprocessing.Process
共享到子进程后,在父进程set(),子进程wait()是不会收到信号的
@youqingkui
youqingkui / PySched.py
Created Aug 3, 2016 — forked from rswofxd/PySched.py
Python:任务调度,定时执行
View PySched.py
#coding=utf-8
import time
import sched
import os
import threading
"""
sched模块,准确的说,它是一个调度(延时处理机制),每次想要定时执行某任务都必须写入一个调度。
使用步骤如下:
(1)生成调度器:
s = sched.scheduler(time.time,time.sleep)
@youqingkui
youqingkui / flask-mail-qq.py
Created Feb 17, 2016 — forked from binderclip/flask-mail-qq.py
用 Flask-Mail 通过 QQ 邮箱发送邮件
View flask-mail-qq.py
from flask import Flask
from flask_mail import Mail, Message
app = Flask(__name__)
app.config.update(
#EMAIL SETTINGS
MAIL_SERVER='smtp.qq.com',
MAIL_PORT=465,
MAIL_USE_SSL=True,
@youqingkui
youqingkui / python-smtp-send-qq-mail.py
Created Feb 17, 2016 — forked from binderclip/python-smtp-send-qq-mail.py
用 Python 发送 QQ 邮箱的邮件
View python-smtp-send-qq-mail.py
import smtplib
from getpass import getpass
def prompt(prompt):
return input(prompt).strip()
fromaddr = prompt("From: ")
toaddrs = prompt("To: ").split()
subject = prompt("Subject: ")
print("Enter message, end with ^D (Unix) or ^Z (Windows):")
You can’t perform that action at this time.