Skip to content

Instantly share code, notes, and snippets.

View muzizongheng's full-sized avatar

muzizongheng(李建功) muzizongheng

View GitHub Profile
private DTE2 _applicationObject;
private AddIn _addInInstance;
private string _githubClientId = @"d15081f5f72ba1075e40";
private string _githubClientSecret = @"68d71642fc2b8872cfa1b2358f03289dbfd656a4";
private string _githubScopes = @"gist";
using System;
using System.Net.Http;
using Extensibility;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio.CommandBars;
using System.Resources;
using System.Reflection;
using System.Globalization;
@muzizongheng
muzizongheng / AccessEN.py
Created July 18, 2013 07:16
use authoToken & noteStoreUrl to init evernote's noteStore
#init evernote client
def initEvernote(self):
# Real applications authenticate with Evernote using OAuth, but for the
# purpose of exploring the API, you can get a developer token that allows
# you to access your own Evernote account. To get a developer token, visit
# https://sandbox.evernote.com/api/DeveloperToken.action
if self.authToken == "":
self.authToken = input("Please input your dev token: ")
if self.authToken == "":
@muzizongheng
muzizongheng / printexample.py
Created July 18, 2013 07:14
print examples
print("first example")
print("second", "example")
print("%s"%("third example"))
print("%(forth)s"%{'forth':'forth example'})
fifth = "fifth example"
print("%(fifth)s"%vars())
@muzizongheng
muzizongheng / Main.py
Created July 18, 2013 06:59
use md5 for file
#calculate hashcode for media
md5 = hashlib.md5()
md5.update(attachment.data.body)
hashcode = md5.hexdigest()
print("hast code: ", hashcode)
@muzizongheng
muzizongheng / Main.py
Created July 18, 2013 06:57
loop to get evernote's notes
# List all of the notebooks in the user's account
notebooks = noteStore.listNotebooks(authToken)
print("Found ", len(notebooks), " notebooks:")
#calculate processed blog count currently
processedBlogCount = 0
for notebook in notebooks:
print(" * ", notebook.name)
@muzizongheng
muzizongheng / AccessEN.py
Created July 18, 2013 06:55
ping blog by url
#ping search engine's ping service
# http://ping.baidu.com/ping/RPC2
# http://rpc.pingomatic.com/
# http://api.moreover.com/ping
# http://api.my.yahoo.com/rss/ping
# http://blogsearch.google.com/ping/RPC2
# http://ping.bitacoras.com
# http://ping.feedburner.com
# http://ping.syndic8.com/xmlrpc.php
# http://rpc.blogrolling.com/pinger/
@muzizongheng
muzizongheng / AccessEN.py
Created July 18, 2013 06:54
convert file to list
pingServiceUrls = open("pingcfg", "r", encoding='utf-8-sig')
pingServiceUrls.seek(0)
self.pingServiceUrls = pingServiceUrls.readlines()
print(self.pingServiceUrls)
@muzizongheng
muzizongheng / AccessEN.py
Created July 18, 2013 06:53
convert str to bool
self.isCreateTags = config["isCreateTags"] == str(True)
self.syncNotebook = config["syncNotebook"]
self.isUsingCSDNBlog = config["isUsingCSDNBlog"] == str(True)
@muzizongheng
muzizongheng / AccessEN.py
Created July 18, 2013 06:53
convert file to dictionary
#read config
input_text = open('config', "r", encoding='utf-8-sig').read()
input_json = "{%(input_text)s}" % vars()
reader = json.JSONDecoder()
config = reader.decode(input_json)