You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
2014-09-12 【Python】GitHub式MarkdownをHTMLに変換し、更にJavaScriptとかの危険なタグを除去しよう python やり方 Markdownは最高 僕はMarkdownは最も最高なマークアップ言語の一つだと思います。なぜならGitHubが全般的に採用しているからです。この文章も全てMarkdownで記述されています。こうやってブログを書いていられるのもMarkdownが使えるからだと思っています。 普通にマークダウン python-markdownを使います。pip install markdownしてfrom markdown import markdownしてhtml = markdown(raw)でポコンとHTMLが生まれます。 GFMを扱う そして世の中にはGitHub式Markdownというものがあります。GitHub Flavored M
RedmineにREST APIがあることを知りました。 http://www.redmine.org/projects/redmine/wiki/Rest_api Pythonから使ってみます。 APIキーの準備 サンプルとして、チケットの登録をやってみたいと思います。 データの参照には不要っぽいのですが、登録にはAPIキーが必要なので、 先に作っておきます。 [管理] - [設定]から、[認証]タブを選択します。 「RESTによるWebサービスを有効にする」という項目があるのでチェック。 保存を実行します。 右上の[個人設定]を選択。 「APIアクセスキー」という項目が表示されるので、「表示」をクリックします。 そうすると、そのユーザーのAPIアクセスキーが表示されます。 APIアクセスキーはユーザーごとに発行されるようです。 使用するアクセスキーに該当するユーザー名でチケットの登録が
I was able to find several Django-based URL shortening apps, but I didn’t want redirection – I wanted native Base62 URLs. Fortunately, it wasn’t hard to roll up a system from scratch. Started by finding a python function to do the basic encoding – this one did the trick. I saved that in a utils.py in my app’s directory. Of course we need a new field to store the hashed strings in – I created a 5-c
This document summarizes an introductory talk on the asyncio module in Python. It discusses the main components of asyncio including: - The event loop which acts as an implicit scheduler, putting callbacks in a queue to be run. - Coroutines, futures and tasks - coroutines are generator functions used for asynchronous code, futures represent values that aren't available yet, and tasks run coroutine
This document summarizes an introductory talk on the asyncio module in Python. It discusses the main components of asyncio including: - The event loop which acts as an implicit scheduler, putting callbacks in a queue to be run. - Coroutines, futures and tasks - coroutines are generator functions used for asynchronous code, futures represent values that aren't available yet, and tasks run coroutine
DjangoCon US 2014 talk on JSON Web Tokens
Funkload Webアプリケーションのパフォーマンス測定ツールについて(サーバー側の負荷も兼ねてだけど)、Apache BenchやSiegeやJMeterがあるけど、 それ以外に何かねえのかな、と思ってStackOverflowを調べていたら Funkloadというものを見つけた。 Python製らしい。なら試しに調査してみるか、ということでいじってみた。 動作環境整備 動作環境として、自分自身の環境は以下の通り。 Mac OS X 10.8 Python 2.7.5 FunkloadはPython 2.x系をサポートしているようなので、2.x系最新の(2013年6月現在の)バージョンを選択する。 Funkloadのドキュメントに載っているMac OS Xでのインストール方法を参考にする。 ...どうやらgnuplotさえ入れられれば良いようだ。homebrewで入れてしまおう。
恐怖のMocking Python と Mock の話。 import されているモジュールをモックに差し替えたいときに from minimock import Mock import hoge hoge.fuga = Mock('hoge.fuga') と安易にやってはいけない。 これだと restore しても元の hoge.fuga には戻らない。 例えば turtle.py というのを考える: # turtle.py def soup(): return 'turtle' tests.py も考える。 import unittest from minimock import Mock, restore import turtle class TurtleTest(unittest.TestCase): def setUp(self): turtle.soup = Mock('tu
『初めてのPython』第2版のp.348に載っている循環インポートについて。 解説1回読んだだけじゃよく分からなかったのでめも。 以下の2つのファイルがあったとします。 #recur1.py x = 1 import recur2 y = 2 #recur2.py from recur1 import x from recur2 import y ここで、対話型コマンドラインで import recur1とすると、 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "recur1.py", line 3, in <module> import recur2 File "recur2.py", line 3, in <module> from recur1 import y ImportE
NetworKit is a growing open-source toolkit for large-scale network analysis. Its aim is to provide tools for the analysis of large networks in the size range from thousands to billions of edges. For this purpose, it implements efficient graph algorithms, many of them parallel to utilize multicore architectures. These are meant to compute standard measures of network analysis, such as degree sequen
>>> c = S3Connection(KEY, SECRET) >>> bucket = c.get_bucket('bucket_name') >>> start = time.time() >>> bucket.get_all_keys() >>> print time.time() - start 0.425064992905 >>> c = S3Connection(KEY, SECRET) >>> bucket = c.get_bucket('bucket_name') >>> start = time.time() >>> bucket.get_all_keys() >>> print time.time() - start 0.000198841094971 Works with Python and Boto MimicDB wraps every S3 API cal
toro: Synchronization primitives for Tornado coroutines¶ Toro logo by Musho Rodney Alan Greenblat With Tornado’s gen module, you can turn Python generators into full-featured coroutines, but coordination among these coroutines is difficult without mutexes, semaphores, and queues. Toro provides to Tornado coroutines a set of locking primitives and queues analogous to those that Gevent provides to G
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く