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 python3 | |
| # NOTE: No Python 2 compat. Redis | |
| """Mixin class for managing rate limiting of API keys via Redis.""" | |
| __all__ = ['RateLimitManagerMixin'] | |
| import datetime | |
| import redis |
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
| package counter | |
| import "container/heap" | |
| // Implement the maxheap used in ic.MostCommon() | |
| // KeyValueHeap is a nested slice that implements the heap interface | |
| // It roughly resembles an ordered mapping where each element is a | |
| // length-2 slice with keys as the 0th element and values as the 1st | |
| // See https://golang.org/pkg/container/heap/ IntHeap example |
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
| package variadic | |
| // Platform-dependent largest and smallest values that int may take on | |
| const ( | |
| LargestInt = int(^uint(0) >> 1) | |
| SmallestInt = -1 * int(^uint(0) >> 1) - 1 | |
| ) | |
| func Min(a ...int) int { | |
| min := LargestInt |
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
| package counter | |
| import ( | |
| "fmt" | |
| "sort" | |
| ) | |
| type kv struct { | |
| Key int | |
| Value int |
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
| def backoff( | |
| url: str, | |
| waitfor: Optional[datetime.timedelta] = None, | |
| waituntil: Optional[datetime.datetime] = None, | |
| base: int = 2, | |
| method: str = 'GET', | |
| bad_status_codes: Optional[Sequence] = None, | |
| session: Optional[requests.Session] = None, | |
| begin_timeout: int = 10, | |
| _now=datetime.datetime.now, |
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
| import asyncio | |
| async def foo(): | |
| await asyncio.sleep(1) | |
| return 2 | |
| async def bar(): | |
| f1 = await foo() | |
| f2 = await foo() | |
| return f1, f2 |
This file has been truncated, but you can view the full file.
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
| https://www.kitchenertoday.com/world-news/trumps-ag-nominee-defends-memo-criticizing-mueller-probe-1194852 | |
| http://www.bomboradyo.com/coa-resident-auditor-nasita-sa-kamara-dahil-sa-flood-control-scam/ | |
| https://www.derbytelegraph.co.uk/news/local-news/live-a6-flood-traffic-delays-2430621 | |
| http://showbizplus.com/index.php/blog/49735/home-insurance-five-ways-to-less/ | |
| https://autoblog.com.ar/2019/01/15/proyecto-cyclone-ya-es-oficial-las-ford-ranger-y-vw-amarok-compartiran-plataforma-a-partir-de-2022/ | |
| https://www.ft.com/content/7990545e-18c7-11e9-b93e-f4351a53f1c3?FTCamp=engage/CAPI/webapp/Channel_Moreover//B2B | |
| http://blog.geogarage.com/2019/01/ocean-warming-is-accelerating-faster.html | |
| https://liberal.com.br/cidades/nova-odessa/oab-de-nova-odessa-pede-intervencao-em-cobranca-da-taxa-de-lixo-943237/ | |
| https://theopenview.in/2019/01/15/pongal-celebrated-in-tn-with-traditional-fervour/ | |
| https://www.huffingtonpost.co.uk/entry/canada-issues-high-caution-travel-warning-for-china-amid-citizens-death-sentence_uk_5c3d9bd2e4b0922 |
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
| print(0xc0ffee) |
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 sh | |
| # | |
| # Miniature version of redis/utils/install_server.sh | |
| # compatible across OS X + Linux | |
| if [ "$(id -u)" -ne 0 ]; then | |
| echo "Must run as root" | |
| exit 1 | |
| fi |