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
package main | |
import ( | |
"bytes" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"mime/multipart" | |
"net/http" | |
"os" |
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
import urlparse | |
def urldecode(query_str): | |
""" | |
>>> urldecode('a=1&b=2') | |
{'a': '1', 'b': '2'} | |
""" | |
return dict(urlparse.parse_qsl(query_str)) |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
import web | |
urls = ( | |
'/', 'Index', | |
) |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
from oauthlib.oauth2 import ( | |
FatalClientError, OAuth2Error, TokenExpiredError, MobileApplicationClient | |
) | |
from requests_oauthlib import OAuth2Session, TokenUpdated |
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
In [1]: class A(): | |
...: def __call__(self, *args, **kwargs): | |
...: return locals() | |
...: | |
In [2]: a = A() | |
In [3]: a() | |
Out[3]: {'args': (), 'kwargs': {}, 'self': <__main__.A instance at 0x281b2d8>} |
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
#!/usr/bin/perl | |
# The MySQL Partitions helper | |
# Copyright (C) 2008, 2009 Giuseppe Maxia | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; version 2 of the License | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import json | |
import sys | |
import urllib | |
if __name__ == '__main__': | |
args = sys.argv | |
if len(args) < 2: |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
根据日期批量创建文件夹. | |
""" | |
from __future__ import print_function | |
from __future__ import unicode_literals |
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
<!doctype netscape-bookmark-file-1> | |
<!-- this is an automatically generated file. | |
it will be read and overwritten. | |
do not edit! --> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>bookmarks</title> | |
<h1>书签菜单</h1> | |
<dl><p> | |
<dt><a href="place:folder=bookmarks_menu&folder=unfiled_bookmarks&folder=toolbar&sort=12&excludequeries=1&excludeitemifparenthasannotation=livemark%2ffeeduri&maxresults=10&querytype=1">最近使用的书签</a> |
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
<?php | |
$text = 'http://abc<a href="http://xxx">xsx</a> http://v2ex.com https://abc<img />abd'; | |
print preg_replace('%(?<!"|\')https?://[^\s<]+%', '<a href="$0">$0</a>', $text); | |
//<a href="http://abc">http://abc</a><a href="http://xxx">xsx</a> | |
//<a href="http://v2ex.com">http://v2ex.com</a> | |
//<a href="https://abc">https://abc</a><img />abd | |
?> |