abs()
delattr()
hash()
| import time | |
| import types | |
| from functools import wraps | |
| from abc import ABCMeta | |
| def timeit(f): | |
| @wraps(f) | |
| def wrapper(*args, **kwargs): | |
| start = time.time() | |
| resp = f(*args, **kwargs) |
| # -*- coding: utf-8 -*- | |
| # SHIFT+CMD+A -> Kite: Tutorial | |
| # CMD+P to show function parameter | |
| # Welcome to... | |
| # | |
| # `hmy+. ://: | |
| # .mMMMMMNho:` NMMm | |
| # :NMMMMMMMMMMMds/.` NMMm :ss: |
| https://requestbin.com/ | |
| RequestBin gives you an instant HTTP endpoint that will collect all the requests sent so that you can interpret them easily to check and validate data. | |
| https://cloudcraft.co/ | |
| Cloudcraft helps you design and budget your cloud. It has a very cool drag and drop interface to create 3D diagrams, by connecting different cloud infrastructure services (currently only for AWS). |
| # Occurrence Counter in List | |
| num_lst = [1, 1, 2, 3, 4, 5, 3, 2, 3, 4, 2, 1, 2, 3] | |
| cnt = Counter(num_lst) | |
| print(dict(cnt)) | |
| # first 2 most occurrence | |
| print(dict(cnt.most_common(2))) | |
| str_lst = ['blue', 'red', 'green', 'blue', 'red', 'red', 'green'] | |
| print(dict(Counter(str_lst))) | |
| # controlar o mouse no Windows. | |
| # https://stackoverflow.com/questions/4263608/ctypes-mouse-events | |
| # see http://msdn.microsoft.com/en-us/library/ms646260(VS.85).aspx for details | |
| import ctypes | |
| import time # opcional | |
| def pos(x, y): | |
| ctypes.windll.user32.SetCursorPos(x, y) |
| docker run -it --rm --entrypoint bash -e ODBCINI=/opt/odbc.ini -e ODBCSYSINI=/opt/ -v "$PWD":/opt lambci/lambda:build-python3.8 | |
| # install unixODBC | |
| curl ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.7.tar.gz -O | |
| tar xzvf unixODBC-2.3.7.tar.gz | |
| cd unixODBC-2.3.7 | |
| ./configure --sysconfdir=/opt --disable-gui --disable-drivers --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE --prefix=/opt | |
| make | |
| make install | |
| cd .. |
| class BitmexAPI: | |
| # Contructor etc... | |
| def place_order(self, order: Order): | |
| def place_order_api_call(): | |
| size_sign = 1 if order.order_side == OrderSide.BUY else -1 | |
| result = self.__bitmex_client.Order.Order_new(symbol='XBTUSD', | |
| orderQty=size_sign * order.size, |
| AWSTemplateFormatVersion : 2010-09-09 | |
| Resources: | |
| LambdaExecutionRole: | |
| Type: AWS::IAM::Role | |
| Properties: | |
| AssumeRolePolicyDocument: | |
| Version: '2012-10-17' | |
| Statement: | |
| - Effect: Allow |
| # https://airflow.apache.org/docs/stable/installation.html | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential mysql-server libmysqlclient-dev libblas-dev libatlas-base-dev | |
| sudo apt-get install -y --no-install-recommends \ | |
| freetds-bin \ | |
| krb5-user \ | |
| ldap-utils \ | |
| libffi6 \ | |
| libsasl2-2 \ |