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 asyncio | |
import time | |
from functools import partial | |
from typing import Any, Callable, Optional | |
async def create_awaitable(func: Callable, *args, **kwargs) -> Any: | |
loop = asyncio.get_running_loop() | |
return await loop.run_in_executor(None, partial(func, *args, **kwargs)) |
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 datetime as dt | |
from stpmex import Client | |
PKEY = """Bag Attributes | |
friendlyName: prueba | |
localKeyID: 54 69 6D 65 20 31 33 32 34 35 39 35 30 31 35 33 33 30 | |
Key Attributes: <No Attributes> | |
-----BEGIN ENCRYPTED PRIVATE KEY----- |
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
from enum import Enum | |
class BankCode(Enum): | |
BANAMEX = '002' | |
BBVA_BANCOMER = '012' | |
SANTANDER = '014' | |
def validate_bank_code(bank_code: str) -> bool: |
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
### Keybase proof | |
I hereby claim: | |
* I am matin on github. | |
* I am matin (https://keybase.io/matin) on keybase. | |
* I have a public key ASCViy2GV3VMclPpFPFveI1Nh2vpy4uUw_60r4P7LML9-Ao | |
To claim this, I am signing this object: |
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
/* month / year expiry stuff */ | |
.select { | |
height: 24px; | |
border: 1px solid #ccc; | |
border-top: 1px solid #888; | |
padding: 0px 0 0 0px; | |
background: url(https://www.poundpay.com/images/dropdown.png) no-repeat right #fff; | |
-webkit-appearance: none; | |
-moz-appearance: none; | |
overflow: hidden; |
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
require 'balanced' | |
# create a test marketplace | |
api_key = Balanced::ApiKey.new.save | |
Balanced.configure(api_key.secret) | |
marketplace = Balanced::Marketplace.new.save | |
# charge $100.00 on a card | |
buyer = Balanced::Account.new( | |
:email_address => "[email protected]", |
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 unittest | |
from sqlalchemy import create_engine | |
from sqlalchemy import Column, Integer | |
from sqlalchemy import String | |
from sqlalchemy import Text | |
from sqlalchemy import ForeignKey | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy.orm import scoped_session | |
from sqlalchemy.orm import relationship |
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
@retry(3) | |
def fails_sometimes(): | |
... |
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
def retry(tries): | |
def decorator(function): | |
def decorated_function(*args, **kwargs): | |
tried = 0 | |
while tried <= tries: | |
try: | |
return function(*args, **kwargs) | |
except Exception, exc: | |
tried += 1 | |
raise exc |
NewerOlder