Skip to content

Instantly share code, notes, and snippets.

View 2garryn's full-sized avatar

Artem Golovinsky 2garryn

  • Russia, Saint-Petersburg
View GitHub Profile
class NonBlockingReplicator: INonBlockingReplicator
{
public event EventHandler Replicated;
private readonly IHttpReplicator _httpReplicator;
public NonBlockingReplicator(IHttpReplicator httpReplicator) => _httpReplicator = httpReplicator;
public void Replicate(Guid id, string serialized, bool notify = true) =>
Task.Run(() => _httpReplicator.Replicate(serialized))
.ContinueWith((replicated) =>
public class ChannelPool
{
private readonly IConnection _connection;
private readonly int _size;
private readonly ChannelReader<PublishMessage> _chan;
public ChannelPool(IConnection connection, int size, ChannelReader<PublishMessage> chan)
{
_size = size;
_connection = connection;
_chan = chan;
class Logger
{
private static volatile Logger instance;
private EventLog _evLog;
private static object lockObject = new object();
public Logger(string logApp, string source)
{
if (!EventLog.SourceExists(source))
EventLog.CreateEventSource(source, logApp);
void delay1(volatile uint32_t delay) {
while (delay--);
}
int main(void) {
rcc_init();
// LED - PD13
RCC->AHB1ENR |=RCC_AHB1ENR_GPIODEN;
#include <stdint.h>
#include <stdio.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
typedef struct {
#include <stdint.h>
#include <stdio.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <inttypes.h>
use std::ops;
use std::fmt;
use rust_decimal::prelude::*;
use std::cmp::Ordering;
use rust_decimal;
use crate::currencies::Currency as Currency;
use crate::percent::Percent as Percent;
use crate::currency_rate::CurrencyRate as CurrencyRate;
use crate::rounding::RoundStrategy as RoundStrategy;