Skip to content

Instantly share code, notes, and snippets.

View smileboywtu's full-sized avatar
🌴
On vacation

wind smileboywtu

🌴
On vacation
View GitHub Profile
@smileboywtu
smileboywtu / py3.5_ubuntu_14.04.txt
Created June 30, 2017 02:12 — forked from larainema/py3.5_ubuntu_14.04.txt
how to install python3.5 on ubuntu 14.04
Felix Krull runs a PPA offering basically any version of Python (seriously, there is 2.3.7 build for vivid...) for many Ubuntu releases at
https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes
Do the usual:
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python3.5
It will not overwrite your existing python3.4 which is still symlinked as python3. If you want python3.5 to be the default python3, change the symlink
@smileboywtu
smileboywtu / send_email.py
Created May 25, 2017 01:35 — forked from lavr/send_email.py
std email vs emails
# see also: http://code.activestate.com/recipes/578150-sending-non-ascii-emails-from-python-3/
import os
import smtplib
from email.utils import formataddr
from email.utils import formatdate
from email.utils import COMMASPACE
from email.header import Header
@smileboywtu
smileboywtu / cuter.py
Created May 11, 2017 09:51 — forked from sigilioso/cuter.py
Python PIL Example: get a thumbnail by resizing and cropping an image.
# -*- coding: utf-8 -*-
import Image
def resize_and_crop(img_path, modified_path, size, crop_type='top'):
"""
Resize and crop an image to fit the specified size.
args:
img_path: path for the image to resize.
@smileboywtu
smileboywtu / python-smtp-send-qq-mail.py
Created May 8, 2017 02:12 — forked from binderclip/python-smtp-send-qq-mail.py
Python & Email,附上用 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):")