Skip to content

Instantly share code, notes, and snippets.

View feymartynov's full-sized avatar

Timofey Martynov feymartynov

  • Wildberries
  • Moscow
View GitHub Profile
@feymartynov
feymartynov / Cargo.toml
Last active October 3, 2022 06:37
vector2 rust
[package]
name = "vector2"
version = "0.1.0"
edition = "2021"
[dev-dependencies]
rand = "0.8"
criterion = "0.4"
[[bench]]
@feymartynov
feymartynov / raspberry_hello_world_rust.md
Created May 9, 2020 00:40
An example of cross compiling Hello World program in Rust for Raspberry Pi Zero

Rust cross compilation for Raspberry Pi Zero

Create a Hello World project:

cargo new hello_rpi
cd hello_rpi

Create .cargo/config.toml in the project directory with the following contents:

@feymartynov
feymartynov / mqtt_gateway.md
Last active December 20, 2019 13:52
Как пользоваться MQTT Gateway

Подключение

Хост/порт

Для сервисов:

  • Testing: tcp://mqtt.testing.svc.netology-group.services:51883
  • Staging: tcp://mqtt.staging.svc.netology-group.services:51883
  • Production: tcp://mqtt.svc.netology-group.services:51883
@feymartynov
feymartynov / README.md
Created December 1, 2019 03:11
WebAudio simple single-track sequencer

WebAudio simple single-track sequencer

How to run

  1. Create 4 1-bar wav samples with 120 BPM and 44100 Hz named from 1.wav to 4.wav.
  2. Run a web server to serve static from the project directory, e.g. python -m http.server and open http://localhost:8000. Just opening index.html in the browser won't work because of CORS policy.
  3. Press Play and you should hear your files playing in a sequence.
  4. Try stop/resume playing, seeking when playing or idle by moving the Position slider and also changing the Tempo.
@feymartynov
feymartynov / README.md
Last active October 15, 2019 21:37
Playing in 18-note scale

Prerequisites: Python 3.7, pip.

Install dependencies:

pip install -r requirements.txt

Turn on sound and run:

@feymartynov
feymartynov / README.md
Created September 28, 2019 19:01
Ruby DSL for ULMS interactions with MQTT

Ruby DSL for ULMS interactions with MQTT

The DSL is useful for development, testing and debugging by enabling quickly writing MQTT interaction scenarios.

Advantages over mosquitto:

  1. Less boilerplate. Actually while providing all the options to mosquitto I can easily forget what I actually want to do with it. This is damn slow.
  2. Ruby is much more nice to read and edit than bash.
@feymartynov
feymartynov / Cargo.toml
Created September 9, 2019 09:33
OutgoingMessage -> dyn Publishable cast problem
[package]
name = "wtf"
version = "0.1.0"
authors = []
edition = "2018"
[dependencies]
serde = "1.0"
serde_derive = "1.0"
@feymartynov
feymartynov / bechmark_setup.sql
Created August 6, 2019 19:36
INT vs VRCHAR vs ENUM
BEGIN;
---------
-- INT --
---------
CREATE TABLE room_int (
id UUID PRIMARY KEY,
time TSTZRANGE NOT NULL,
audience TEXT NOT NULL,
@feymartynov
feymartynov / Dockerfile.buster
Created June 25, 2019 01:18
OpenSSL DTLS problem in Debian buster
FROM debian:buster
RUN apt-get update && apt-get install -y openssl libssl-dev gcc
COPY example.c /example.c
RUN gcc -I/usr/include/openssl -lssl -lcrypto -o example example.c
CMD ["/example"]
@feymartynov
feymartynov / elixir_oop.ex
Created March 12, 2019 00:50
Encapsulation & inheritance in Elixir. This is just for fun and is not idiomatic. Please don't use it in your projects.
defmodule Inheritance do
defmacro __using__(opts) do
quote bind_quoted: [opts: opts] do
@base_mod opts[:extend] || raise("`extend` option is not specified")
fields = opts[:fields] || []
fields =
if Enum.all?(fields, &is_atom/1) do
Enum.map(fields, &{&1, nil})