Skip to content

Instantly share code, notes, and snippets.

@guori12321
Created May 30, 2015 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guori12321/679033e7345f59f698dc to your computer and use it in GitHub Desktop.
Save guori12321/679033e7345f59f698dc to your computer and use it in GitHub Desktop.
一个为JustWriting新建中文题目博文的小脚本
#!/usr/bin/env python
import sys
import time
from pypinyin import pinyin, lazy_pinyin
import pypinyin
py = lazy_pinyin(unicode("_".join(sys.argv[1:]), "utf-8"))
fileName = ''.join(py)
print fileName
with open(time.strftime("%Y-%m-%d-")+fileName+'.md', 'a') as fin:
fin.write("Date: %s\n" % time.strftime("%Y-%m-%d"));
fin.write("Title: %s\n" % " ".join(sys.argv[1:]))
fin.write("Tags: Tech\n")
fin.write("Status: draft\n\n")
from subprocess import call
call(["mvim", time.strftime("%Y-%m-%d-")+fileName+'.md'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment