forked from pythonpeixun/article
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9ab759
commit afd1ecb
Showing
285 changed files
with
43,963 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/Users/hjzaaa/article/python/how_to_learn_python.md |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/Users/hjzaaa/article/python/main-4.png |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/Users/hjzaaa/article/.media/marboo_config.json |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#+TITLE: Marboo Main Config | ||
#+AUTHOR: amoblin | ||
#+EMAIL: [email protected] | ||
#+DATE: 2014-01-15 22:42:20 | ||
#+OPTIONS: ^:{} | ||
|
||
* Supported files with: | ||
|
||
- markdown | ||
- reStructuredText | ||
- Org-mode | ||
- Textile | ||
- txt2tag | ||
- HTML | ||
- zip | ||
|
||
* Syntax Highlight for Code | ||
|
||
* Extend Packages | ||
** DONE Phot Gallery | ||
CLOSED: [2014-05-19 Mon 22:59] | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
# author: amoblin <[email protected]> | ||
# file name: alert.sh | ||
# create date: 2013-02-03 15:48:48 | ||
|
||
cat "$1" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
# author: amoblin <[email protected]> | ||
# file name: audio2html.sh | ||
# create date: 2014-06-26 14:42:23 | ||
# This file is created from $MARBOO_HOME/media/starts/default.sh | ||
# 本文件由 $MARBOO_HOME/media/starts/default.sh 复制而来 | ||
|
||
name=`basename "$1"` | ||
#tmp_file=/tmp/$name | ||
echo "<h1>$name</h1>\ | ||
<div class=\"player\" style=\"margin-top:100px; text-align:center\">\n\ | ||
<audio controls=\"\" name=\"media\">\n \ | ||
<source src=\"$name\" type=\"audio/mpeg\">\n \ | ||
</audio>\n \ | ||
</div>" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
# author: amoblin <[email protected]> | ||
# file name: flash2html.sh | ||
# description: TODO | ||
# create date: 2015-02-18 13:55:37 | ||
# This file is created from $MARBOO_HOME/.media/starts/default.sh | ||
# 本文件由 $MARBOO_HOME/.media/starts/default.sh 复制而来 | ||
|
||
name=`basename "$1"` | ||
name_without_extension=`echo ${name%.*}` | ||
#tmp_file=/tmp/$name | ||
echo "<div style=\"text-align:center\">\n \ | ||
<h1>$name_without_extension</h1>\n \ | ||
<div style=\"margin-top:100px\">\n \ | ||
<embed height=\"500px\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" quality=\"high\" src=\"$name\" title=\"\" type=\"application/x-shockwave-flash\" width=\"700px\" />\n \ | ||
</div>\n \ | ||
</div>\n" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env python | ||
# -*- coding:utf-8 -*- | ||
# author: amoblin <[email protected]> | ||
# file name: ghost-publish.py | ||
# create date: 2014-08-30 16:14:13 | ||
# This file is created from $MARBOO_HOME/media/starts/default.py | ||
# 本文件由 $MARBOO_HOME/media/starts/default.py 复制而来 | ||
|
||
import sys | ||
import json | ||
import requests | ||
|
||
USERNAME = "INPUT YOUR USER NAME" | ||
PASSWORD = "INPUT YOUR PASSWORD" | ||
HOST = "http://localhost:2368" | ||
|
||
GHOST_API_PRE = "/ghost/api/v0.1" | ||
GHOST_API_AUTH = "/authentication/token" | ||
GHOST_API_POSTS = "/posts" | ||
|
||
class Ghost: | ||
def __init__(self): | ||
self.s = requests.session() | ||
self.get_access_token() | ||
|
||
def get_full_url(self, path): | ||
return "%s%s%s" % (HOST, GHOST_API_PRE, path) | ||
|
||
def get_access_token(self): | ||
params = { | ||
"grant_type": "password", | ||
"username": USERNAME, | ||
"password": PASSWORD, | ||
"client_id": "ghost-admin" | ||
} | ||
|
||
r = self.s.post(self.get_full_url(GHOST_API_AUTH), data=params) | ||
response_dict = r.json() | ||
self.access_token = response_dict["access_token"] | ||
self.token_type = response_dict["token_type"] | ||
|
||
def get_posts(self): | ||
headers = {"Authorization": "%s %s" % (self.token_type, self.access_token)} | ||
payload = {"limit": 10} | ||
content = self.s.get(self.get_full_url(GHOST_API_POSTS), headers=headers, params=payload).json() | ||
return content | ||
|
||
def post_one(self, title, content): | ||
headers = {"Authorization": "%s %s" % (self.token_type, self.access_token)} | ||
# payload = {"object":{"title": title, "markdon": content, "author": USERNAME}, "options": "TBD"} | ||
payload = {} | ||
|
||
content = self.s.post(self.get_full_url(GHOST_API_POSTS), headers=headers, params=payload).json() | ||
return content | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) > 2: | ||
USERNAME = sys.argv[1] | ||
PASSWORD = sys.argv[2] | ||
|
||
if len(USERNAME) == 0 or len(PASSWORD) == 0: | ||
print("Arguments Error") | ||
sys.exit(1) | ||
|
||
ghost = Ghost() | ||
for post in ghost.get_posts()["posts"]: | ||
print post["title"] | ||
print ghost.post_one("测试", "# 本文通过%s发送" % __file__) | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
# author: amoblin <[email protected]> | ||
# file name: tar-list.sh | ||
# create date: 2013-03-07 15:13:36 | ||
# This file is created from $MARBOO_HOME/media/starts/default.sh | ||
# 本文件由 $MARBOO_HOME/media/starts/default.sh 复制而来 | ||
|
||
name=`basename "$1"` | ||
echo "# ${name}" | ||
tar tvf "$1"|sed 's/^/ /' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
# author: amoblin <[email protected]> | ||
# file name: video2html.sh | ||
# create date: 2014-07-06 06:37:27 | ||
# This file is created from $MARBOO_HOME/media/starts/default.sh | ||
# 本文件由 $MARBOO_HOME/media/starts/default.sh 复制而来 | ||
|
||
name=`basename "$1"` | ||
name_without_extension=`echo ${name%.*}` | ||
#tmp_file=/tmp/$name | ||
echo "<div style=\"text-align:center\">\n \ | ||
<h1>$name_without_extension</h1>\n \ | ||
<div class=\"player\" style=\"margin-top:100px\">\n\ | ||
<video controls=\"\" name=\"media\" width=\"80%\">\n \ | ||
<source src=\"$name\" type=\"video/mp4\">\n \ | ||
</video>\n \ | ||
</div>" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
# author: amoblin <[email protected]> | ||
# file name: zip-list.sh | ||
# create date: 2013-03-01 11:27:53 | ||
# This file is created from $MARBOO_HOME/media/starts/default.sh | ||
# 本文件由 $MARBOO_HOME/media/starts/default.sh 复制而来 | ||
|
||
name=`basename "$1"` | ||
echo "# ${name}" | ||
unzip -l "$1"|sed 's/^/ /' |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.