Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Aleksei Slaikovskii slaykovsky

🎯
Focusing
Block or report user

Report or block slaykovsky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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
View module_getattr.py
from importlib import import_module, resources
PLUGINS = {}
def register_plugin(f):
PLUGINS[f.__name__] = f
return f
@slaykovsky
slaykovsky / configuration.nix
Created Feb 4, 2017
My nixos configuration.
View configuration.nix
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
View 0001-Read-content-from-a-request.patch
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. :)
View fonts.conf
<?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">
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
(setq
View Ledger.java
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 -> {
View Ledger.java
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)
You can’t perform that action at this time.