Skip to content

Instantly share code, notes, and snippets.

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");
@gabbhack
gabbhack / http_client_pool.nim
Created March 20, 2021 06:10 — forked from jackhftang/http_client_pool.nim
Nim HttpClientPool
import asyncdispatch
import deques
import options
import httpclient
import strformat
export httpclient # for AsyncResponse
#[
Wrapping AsyncHttpClient for pooling and timeout, also see
@gabbhack
gabbhack / main.py
Created October 20, 2019 10:26
aiogram i18n example
from pathlib import Path
from typing import Tuple, Any
from aiogram import Bot, Dispatcher, executor, types
from aiogram.contrib.middlewares.i18n import I18nMiddleware
TOKEN = "TOKEN"
I18N_DOMAIN = "mybot"
BASE_DIR = Path(__file__).parent
@gabbhack
gabbhack / elite.py
Last active October 14, 2019 16:37
Joke
import inspect
import asyncio
import functools
from typing import Callable, TypeVar, Union, NewType, Coroutine, Awaitable, Any
__all__ = ["timer", "WaitTime", "Callback", "ReturnType"]
T = TypeVar("T")
from gino import Gino
db = Gino()
async def start():
await db.set_bind('postgresql://localhost/gino')
# Create tables
await db.gino.create_all()
@gabbhack
gabbhack / Procfile
Last active June 28, 2019 10:34
Test redis expire argument
worker: python test_redis.py
import asyncio
from aiogram import Bot, Dispatcher, executor, types
from aiogram.contrib.fsm_storage.redis import RedisStorage2
from aiogram.dispatcher import DEFAULT_RATE_LIMIT
from aiogram.dispatcher.handler import CancelHandler, current_handler
from aiogram.dispatcher.middlewares import BaseMiddleware
from aiogram.utils.exceptions import Throttled
TOKEN = 'BOT TOKEN HERE'