Skip to content

Instantly share code, notes, and snippets.

@pheix
pheix / readme.md
Created April 10, 2023 07:03 — forked from SanariSan/readme.md
Telegram HTTP bot API via CURL | Send text, photos, documents, etc.

Here are some examples on how to use Telegram bot api via CURL

Prerequisites

For getting messages in private chat with bot

  • Create a bot using @BotFather, get it's token
  • Start conversation with bot
  • Run following curl command
curl https://api.telegram.org/bot/getUpdates | grep -Po '"from":{"id":.+?,'

Trove testing tool — yet another TAP harness

Intro

Since the early Pheix versions, I have paid a lot of attention to testing system. Initially it was a set of unit tests — I tried to cover a huge range of units like classes, methods, subroutines and conditions. In some cases I have combined unit and functional testing within one .t file, like it's done to verify Ethereum or API related functionality.

Tests became a bit complicated and environment dependent. For example off chain testing like trivial prove6 -Ilib ./t should skip any Ethereum tests including some API units, but not API template engine or cross module API communications. So I had to create environment dependent configurations and since that point I started yet another Pheix friendly test system.

It was written in pure bash and was included in Pheix repository for a few years.

@pheix
pheix / Raku-Advent-2021.md
Last active December 9, 2021 14:28
A long journey to Ethereum signatures

A long journey to Ethereum signatures

The Ethereum blockchain is essentially a transaction-based state machine. We begin with a blank state, before any transactions have happened on the network, and move into some final state when transactions are executed. The state of Ethereum relies on past transactions. These transactions are grouped into blocks and each block is chained together with its parent.

Transactions are processing by own Turing complete virtual machine - known as the Ethereum Virtual Machine (EVM). The EVM has its own language: EVM bytecode. Typically programmer writes the program in a higher-level language such as Solidity. Then the program should be compiled down to EVM bytecode and commited to the Ethereum network as the new transaction. The EVM executes the transaction recursively, computing the system state and

@pheix
pheix / Raku-Advent-2020.md
Last active February 28, 2023 20:22
Raku web templating engines: boost up the parsing performance 

Raku web templating engines: boost up the parsing performance

Modern Raku web templating engines

A templating engine basically provides tools for effective metadata interpolation inside static files (templates). At web application runtime, the engine parses and replaces variables with actual content values. Finally client gets a HTML page generated from the template, where all metadata (variables, statements, expressions) has been proceed.

Raku ecosystem has a few modern templating engines: Template::Mojo (last commit on 12 Jun 2017), Template::Mustache (last commit on 25 Jul 2020 — it's alive!), Template6 (last commit on 20 Nov 2020 - active maintenance), Template::Classic (last commit on 11 Apr 2020), [Template

@pheix
pheix / pheix-bigbro.sol
Created June 7, 2018 13:10
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.21;
contract BigBro {
struct Statistics {
uint id;
string referer;
string ip;
string useragent;
string resolution;
string page;
string country;
@pheix
pheix / pheix-bigbro.sol
Created May 30, 2018 14:41
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.21;
contract BigBro {
struct Statistics {
uint id;
string referer;
string ip;
string useragent;
string resolution;
string page;
string country;