Skip to content

Instantly share code, notes, and snippets.

View slaykovsky's full-sized avatar
🎯
Focusing

Aleksei Slaikovskii slaykovsky

🎯
Focusing
  • London, UK
View GitHub Profile
#pragma once
#include <memory>
#include <optional>
template <typename k_type, typename v_type>
class tree
{
enum color : bool
# 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
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
PLUGINS = {}
def register_plugin(f):
PLUGINS[f.__name__] = f
return f
From 8bc692c33ec2e324e4400576d105495fa33f2ba9 Mon Sep 17 00:00:00 2001
From: Alexey Slaykovsky <alexey@slaykovsky.com>
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. :)
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="pattern">
<edit mode="assign" name="dpi">
<double>96</double>
</edit>
</match>
<match target="font">
<edit mode="assign" name="autohint">
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
module Main where
import Control.Arrow
import Control.Concurrent
import Control.Exception
import Control.Monad.Reader
import Data.Either
;;; 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
(setq
public Transaction[] handleTxs(Transaction[] possibleTxs) {
Set<Transaction> sortedTxs = new TreeSet<>(
(x, y) -> Double.compare(this.makeTxFees(y), this.makeTxFees(x)));
Collections.addAll(sortedTxs, possibleTxs);
Set<Transaction> validTxs = new HashSet<>();
sortedTxs.parallelStream().filter(this::isValidTx).map(tx -> {
validTxs.add(tx);
tx.getInputs().parallelStream().map(in -> {
public double makeTxFees(Transaction tx) {
if (!this.isValidTx(tx)) {
return 0;
}
double inputValuesSum = tx.getInputs()
.parallelStream()
.map((x) -> new UTXO(x.prevTxHash, x.outputIndex))
.filter((x) -> this.utxoPool.contains(x))
.mapToDouble((x) -> this.utxoPool.getTxOutput(x).value)