Skip to content

Instantly share code, notes, and snippets.

View AndreiPashkin's full-sized avatar

Andrew Pashkin AndreiPashkin

  • Warsaw
  • 15:16 (UTC -12:00)
View GitHub Profile
@AndreiPashkin
AndreiPashkin / grace_stop.py
Last active July 8, 2019 17:47 — forked from worldmind/grace_stop.py
Multiprocessing graceful stop
import time
import multiprocessing as mp
import queue as queuelib
N_PROCESSES = 4
def worker(queue: mp.Queue, stop: mp.Event):
print(f"Start job: {mp.current_process().name}")
@AndreiPashkin
AndreiPashkin / dev_raw_data_source_batch_size.json
Created October 24, 2019 08:55
Dev Raw Data Source ignores batch size
{
"pipelineConfig" : {
"schemaVersion" : 6,
"version" : 14,
"pipelineId" : "test213a3bfd-8099-4184-b12a-f99912cede29",
"title" : "test",
"description" : "",
"uuid" : "52c068b0-0487-4426-8dfc-6910b827a03e",
"configuration" : [ {
"name" : "executionMode",
@AndreiPashkin
AndreiPashkin / compiled_statement.py
Created January 21, 2020 11:37
Compiled statement example
import sqlalchemy as sa
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = 'users'
@AndreiPashkin
AndreiPashkin / benchmark.py
Last active April 17, 2020 09:22
Aiopg result module optimization benchmark setup
import asyncio
import json
import timeit
import aiopg
import aiopg.sa
import asyncpg
import sqlalchemy as sa
import sqlalchemy.dialects.postgresql
@AndreiPashkin
AndreiPashkin / sqlalchemy_example.py
Created February 14, 2021 15:39 — forked from ronreiter/sqlalchemy_example.py
SQLAlchemy Example
from sqlalchemy import Column, Integer, String, ForeignKey, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref, sessionmaker, joinedload
# For this example we will use an in-memory sqlite DB.
# Let's also configure it to echo everything it does to the screen.
engine = create_engine('sqlite:///:memory:', echo=True)
# The base class which our objects will be defined on.
Base = declarative_base()
@AndreiPashkin
AndreiPashkin / xorshift.rs
Created April 16, 2025 00:38
Compile-time Xorshift implementation for Rust
//! Compile-time implementation of Xorshift PRNG for 16, 32, and 64-bit integers, based on
//! [Marsaglia (2003)] and [Metcalf (n.d.)].
//!
//! [Marsaglia (2003)]: https://www.jstatsoft.org/article/view/v008i14
//! [Metcalf (n.d.)]: http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html
pub struct XorShift<T: Default + Copy> {
state: T,
}
impl XorShift<u16> {