Skip to content

Instantly share code, notes, and snippets.

Bitrix comms

Inputs

Bitrix auth:

  • Test cloud bitrix24 ceo@treebo.io Cig-ZMV-L34-Th9

  • User on server

Timer module

Implement functionality of a timer in event-action paradigm.

The API of the timer should be the following:

class TimerModule:
  
 ## Actions

Interpolate dict

Intro

Let's say you have a text string that greets a person, 'Hello, Mark!'. If you write a program for this greeting you might want to compose the string for any name of the person. One way to do this is to have a template string, 'Hello, ${user_name}!' and then use a function that will replace the ${...} with value of variable user_name. This is usually called string interpolation.

We want to have a dict interpolation, where the same is done for a nested structure. For example, if you have a dictionary, {'user':'User_id${uid}'}, and a variable uid=1, we want to get

UNIX Philosophy

  1. Write programs that do one thing and do it well.
  2. Write programs to work together.
  3. Write programs to handle text streams, because that is a universal interface.

Different concerns

  • Parse the file
  • Simulate circuit

Webhook url, Integromat->Treebo

http://test.treebo.io:5002/webhooks/generic_webhook/test123

POST request. Payload format - JSON

{
    phone: str,

text: str

@danlkv
danlkv / cmake
Last active June 17, 2020 22:14
Exatn install fails
-- The CXX compiler identification is GNU 10.1.0
-- The Fortran compiler identification is GNU 10.1.0
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working Fortran compiler: /usr/bin/gfortran
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC8tWC2RnWqGNzcsZRkvi2TGltGf+zyM+9w9A2LHqeG8UnVy3/Pu+njmz3I6GWLGOXrRUU5HGJdTxl2UG7qVgMVVVjVwrV9EOgj4We5e6kYNUnCay9sVIgKRpxJeNo1mwBHEXzryAoNNbgGCMTpA+kEc8SAMAsoahFP/nHdYZqRXd5UxG25AmpczOe6FiaktyUjinfTnfMVAGVvrEm7OVgeXfUriBp6Mjjg9ZRHc02f3miHMywFZWkxqaEkTsM0gubymt8ivXGbY8p7/Gk2xpF958yACoZXvxH7amyUekaDKAE2S8Xhur+HeGZTw/YCbCDQZ0iA/MCBNkAmOu0/1Zppdip8rBhT9EPAu/hUy3DaOk+NXW/nZnlV4FL+hiity82oVqInX/TQvD5SA7d5WbxvvpYcBlCdY19BGqt2pzH1Y8B6BptfpYw1duxJE4eJ2MghvM7faSnScx48m9/FYgkv7fzGqwSWGtvi2+Q8zPPL1x53iB3lFQrdykFOoHEug38= dali@archlinux
@danlkv
danlkv / test_treebo_task_4_health_event_notifier.md
Last active November 2, 2020 05:48
Test task: System health event notifier

System health event notifier

Problem setting

Suppose you have a remote system behind an API. The system is reactive: you send something to it, and it is expected to do something in result. There is an API endpoint (sink) that receives requests and a callback (source) that sends responses.

Sink is just a python function that eventually calls an http endpoint. Source could be implemented as webhook or a generator, but we'll focus on the latter case.

@danlkv
danlkv / test_treebo_task_5_github_api.md
Created November 3, 2020 17:30
Test task: Github API

Filter commit history of github

Task

Get commits of a repository and return info about commits that contain a search query (string) in commit message.

Inputs:

  1. Repository url
  2. String to search for
@danlkv
danlkv / test_treebo_task_6_queue_timeout.md
Last active November 4, 2020 16:52
Test task: queue with timeout

Queue with timeout

A FIFO (First in first out) queue has two main methods:

  1. put(), with puts an element to the queue,
  2. get(), which returns next element.

If queue is empty, get() blocks.

Task