Skip to content

Instantly share code, notes, and snippets.


Aleksei Slaikovskii slaykovsky

View GitHub Profile
View rbtree.h
#pragma once
#include <memory>
#include <optional>
template <typename k_type, typename v_type>
class tree
enum color : bool
View tmux.conf
# Ring the bell if any background window rang a bell
set -g bell-action any
# Default termtype. If the rcfile sets $TERM, that overrides this value.
set -g default-terminal screen-256color
# Keep your finger on ctrl, or don't
bind-key ^D detach-client
# Create splits and vertical splits
View coins.hs
import Control.Monad.State
type Coins = [Int]
type StMatch a = StateT Coins IO a
nextCoin :: Int -> StMatch Int
nextCoin amount = do
c:cs <- get
if amount >= c
from importlib import import_module, resources
def register_plugin(f):
PLUGINS[f.__name__] = f
return f
View 0001-Read-content-from-a-request.patch
From 8bc692c33ec2e324e4400576d105495fa33f2ba9 Mon Sep 17 00:00:00 2001
From: Alexey Slaykovsky <>
Date: Sat, 12 May 2018 11:38:53 +0200
Subject: [PATCH] Read content from a request
Now it reads the content from an incoming request.
Also changed formatting to fit the Go standards.
And changed PUT to POST for a createContent handling. :)
View fonts.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<match target="pattern">
<edit mode="assign" name="dpi">
<match target="font">
<edit mode="assign" name="autohint">
View main.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
module Main where
import Control.Arrow
import Control.Concurrent
import Control.Exception
import Control.Monad.Reader
import Data.Either
View init.el
;;; package --- Summary
;;; Commentary:
;;; Use it on your own risk :)
;;; Code:
(setq gc-cons-threshold 64000000)
(add-hook 'after-init-hook #'(lambda () (setq gc-cons-threshold 800000)))
;;; global vars
public Transaction[] handleTxs(Transaction[] possibleTxs) {
Set<Transaction> sortedTxs = new TreeSet<>(
(x, y) ->, this.makeTxFees(x)));
Collections.addAll(sortedTxs, possibleTxs);
Set<Transaction> validTxs = new HashSet<>();
sortedTxs.parallelStream().filter(this::isValidTx).map(tx -> {
tx.getInputs().parallelStream().map(in -> {
public double makeTxFees(Transaction tx) {
if (!this.isValidTx(tx)) {
return 0;
double inputValuesSum = tx.getInputs()
.map((x) -> new UTXO(x.prevTxHash, x.outputIndex))
.filter((x) -> this.utxoPool.contains(x))
.mapToDouble((x) -> this.utxoPool.getTxOutput(x).value)
You can’t perform that action at this time.