Instance | Branch |
---|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
print os.path.getsize("c:\\temp\\my.file") # returns the size in bytes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Quick script to beemind entering at least some meals into MyFitnessPal for the day. | |
Setup instructions: | |
- install myfitnesspal, requests and keyring (if you don't have them) | |
- call keyring.set_password("myfitnesspal", <your_username>, <your_password>) | |
- call keyring.set_password("beeminder", <your_username>, <your_api_key>) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import marshal | |
def main(): | |
if len(sys.argv) < 2: | |
print "usage: profile2csv file -> profile.csv" | |
f = open(sys.argv[1], "r") | |
k = marshal.loads(f.read()) | |
f.close() | |
f = open("profile.csv", "w") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Demonstrates how to use the blocking scheduler to schedule a job that executes on 3 second | |
intervals. | |
""" | |
from datetime import datetime | |
import os | |
import threading | |
from apscheduler.schedulers.blocking import BlockingScheduler |
- Launch one T2 micro instance, using Ubuntu 14.04 LTS AMI.
- Open SSH and Bitcoin Protocol TCP ports: 22, 8333.
- Attach 40GB EBS (General-Purpose SSD) volume for blockchain storage to /dev/sdf.
The pricing should be ~3$ for the first year (assuming 30GB upload per month). See here for more details.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*-coding:utf-8-*- | |
def seg(pinyin): | |
sm = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'w', 'x', 'y', 'z', 'sh', 'zh', 'ch'] | |
ymd = {'a': {'i':None, 'o':None, 'n': {'g': None}}, | |
'e': {'i':None, 'r':None, 'n': {'g': None}}, | |
'i': {'e':None, 'a':{'n':{'g':None}, 'o':None}, 'u':None, 'o':{'n':{'g':None}}, 'n':{'g':None}}, | |
'o': {'u':None, 'n':{'g':None}}, | |
'u': {'a':{'i':None, 'n':{'g':None}}, 'e':None, 'i':None, 'o':None} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from pypinyin import pinyin, lazy_pinyin, Style | |
def cn_char(text): | |
return all('\u4e00' <= char <= '\u9fff' for char in text) | |
if __name__ == '__main__': | |
data =[] | |
with open('contacts.csv', encoding='utf-8') as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository | |
$ git ls-files | xargs wc -l |
OlderNewer