Skip to content

Instantly share code, notes, and snippets.

@shrddr
shrddr / bouncy.cs
Last active February 13, 2021 20:42
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using Org.BouncyCastle.Math;
using Org.BouncyCastle.Crypto.Tls;
namespace test_ssl_bouncy
LIST = """ул. Налибокская, 34;
ул. Якубовского, 34;
ул. Шаранговича, 34;
ул. Пушкина, 38;
ул. Притыцкого, 54;
ул. Рафиева, 109;
ул. Бурдейного, 25;
ул. Ульяновская, 32;
ул. Каменногорская, 18;
ул. Одинцова, 89;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# plot voltages captured by arduino ADC (AnalogReadSerial example)
# capture data with RealTerm 3.0
# use custom timestamp format: yyyy-mm-dd hh:nn:ss.zzz
import pandas as pd
df = pd.read_csv('capture.txt', names=['t','v'], parse_dates=['t'])
df['v'] = df['v'] / 1023 * 5
df['ms'] = (df['t'] - df['t'][0]).astype('timedelta64[ms]')
df.plot('ms','v')
@shrddr
shrddr / main.cpp
Last active November 23, 2020 09:25
component architecture
/* In this model, the actor owns a bunch of components, which in turn
serves as the base class for the component interfaces. Whenever a
system needs access to a component, it asks the actor for that interface
and gets a pointer to the appropriate interface object. */
struct Component
{
};
@shrddr
shrddr / modelview.cpp
Last active November 23, 2020 09:27
who owns who
IModel* m = new MyModel();
shared_ptr <IView> v(MyView());
m->addView;
#include <iostream>
#include <vector>
class SpriteSet
{
public:
SpriteSet(int count) { m_count = count; }
void render() { std::cout << m_count << " sprites\n"; }
private:
int m_count;
@shrddr
shrddr / factory.cpp
Created March 16, 2016 14:32
c++ factory
#include <iostream>
#include <vector>
class GameState
{
public:
static GameState* create(int choice);
virtual void invoke() = 0;
};