This file contains hidden or 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 | |
| import sys | |
| import json | |
| import requests | |
| def do_gist_json(s): | |
| """ Use json to post to github. """ | |
| gist_url = 'https://api.github.com/gists' |
This file contains hidden or 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
| >>> wow = "wow" | |
| >>> udalo_sie = "^_^" | |
| >>> |
This file contains hidden or 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 timeit | |
| from memcache import Client | |
| mc = Client(['127.0.0.1:11211'], debug=0) | |
This file contains hidden or 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 timeit | |
| from umemcache import Client | |
| umc = Client('127.0.0.1:11211') | |
| umc.connect() |
This file contains hidden or 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 timeit | |
| from memcache import Client | |
| from multiprocessing import Process | |
| def worker(x, y): | |
| mc = Client(['127.0.0.1:11211'], debug=0) |
This file contains hidden or 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 timeit | |
| from umemcache import Client | |
| from multiprocessing import Process | |
| def worker(x, y): | |
| umc = Client('127.0.0.1:11211') |
This file contains hidden or 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 timeit | |
| from pylibmc import Client | |
| mc = Client(['127.0.0.1']) | |
This file contains hidden or 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 timeit | |
| from pylibmc import Client | |
| from multiprocessing import Process | |
| def worker(x, y): | |
| mc = Client(['127.0.0.1']) |
This file contains hidden or 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
| >>> from random import randint | |
| >>> from collections import Counter | |
| >>> l = [randint(0, 333) for x in xrange(100)] | |
| >>> c = Counter(l) | |
| >>> c.most_common(5) | |
| [(286, 3), (314, 3), (133, 2), (139, 2), (142, 2)] | |
| >>> c[286] | |
| 3 |
This file contains hidden or 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
| >>> from collections import deque | |
| >>> l = deque([]) | |
| >>> for x in xrange(15): | |
| >>> l.appendleft(x) | |
| >>> l.append(x) | |
| >>> print l | |
| deque([14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) |
OlderNewer