Skip to content

Instantly share code, notes, and snippets.

@youqingkui
youqingkui / python
Created July 5, 2018 14:19 — forked from 582033/python
树莓派获取[cpu温度/cpu使用率/内存空闲率]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
显示树莓派cpu温度、使用率及内存使用率
'''
import os
def show_temp():
file = open("/sys/class/thermal/thermal_zone0/temp")
@youqingkui
youqingkui / log_test11.py
Created January 16, 2018 03:21 — forked from anonymous/log_test11.py
Test script showing usage of a buffering SMTP handler.
#!/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 March 24, 2017 21:42 — forked from selfboot/centos_python.sh
CentOS 6.8: Install Python 2.7.10, pip, virtualenv, and virtualenvwrapper on CentOS
#!/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
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 November 22, 2016 08:09 — forked from upsuper/tree.md
一行 Python 实现树

一行 Python 实现树

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

def tree(): return defaultdict(tree)

就是这样!

@youqingkui
youqingkui / PySched.py
Created August 3, 2016 02:07 — forked from rswofxd/PySched.py
Python:任务调度,定时执行
#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 February 17, 2016 07:35 — forked from binderclip/flask-mail-qq.py
用 Flask-Mail 通过 QQ 邮箱发送邮件
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 February 17, 2016 07:35 — forked from binderclip/python-smtp-send-qq-mail.py
用 Python 发送 QQ 邮箱的邮件
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):")
@youqingkui
youqingkui / urlparse.py
Last active September 17, 2015 06:39 — forked from zhenyi2697/urlparse.py
Python: urlparse demo
#!/usr/bin/python
# The urlparse module provides functions for breaking URLs down into their
# component parts, as defined by the relevant RFCs.
from urlparse import urlparse
# PARSING
parsed = urlparse('http://user:pass@NetLoc:80/path;parameters?query=argument#fragment')