Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Aleksei Slaikovskii slaykovsky

🎯
Focusing
View GitHub Profile
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)
View main.kt
import kotlin.reflect.full.findAnnotation
import kotlin.reflect.full.memberProperties
@Target(AnnotationTarget.PROPERTY)
annotation class JsonFileId
interface JsonSerializable
fun JsonSerializable.serialize(): String {
View core.clj
(ns learnclojure.core
(require [clojure.core.async :as async :refer [thread]]
[clojure.data.json :as json]
[clojure.core.match :refer [match]])
(use [clojure.string :as strings :only [includes?
lower-case
index-of
split
triml
starts-with?
View sysctl.conf
fs.inotify.max_user_watches = 83886080
vm.vfs_cache_pressure = 50
vm.swappiness = 0
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
net.ipv4.tcp_timestamps = 0
net.core.netdev_max_backlog = 250000
net.core.rmem_max = 83886080
net.core.wmem_max = 83886080
net.core.rmem_default = 83886080
View main.go
package main
import "fmt"
type ListNode struct {
Val int
Next *ListNode
}
func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode {
View Store.kt
import java.math.BigDecimal
import java.util.*
inline fun <T> Iterable<T>.sumByPrice(selector: (T) -> Price): Price {
return this.fold(Price.identity) { a: Price, b: T -> a + selector(b) }
}
inline fun <T> Iterable<T>.sumByWeight(selector: (T) -> Weight): Weight {
return this.fold(Weight.identity) { a: Weight, b: T -> a + selector(b) }
}
View Store.kt
inline fun <T> Iterable<T>.sumByPrice(selector: (T) -> Price): Price {
return this.map(selector).reduce({acc: Price, price: Price -> acc + price })
}
inline fun <T> Iterable<T>.sumByWeight(selector: (T) -> Weight): Weight {
return this.map(selector).reduce({acc: Weight, weight: Weight -> acc + weight })
}
data class Price(private val value: BigDecimal) {
operator fun plus(price: Price) = Price(this.value + price.value)
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 gauss.c
#include <math.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#ifndef COEFF_ARR_SIZE
#define COEFF_ARR_SIZE 8
#endif
float a0, a1, a2, a3, b1, b2, left_corner, right_corner;
View config
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 4.10.1-gentoo Kernel Configuration
#
#
# Gentoo Linux
#
CONFIG_GENTOO_LINUX=y
CONFIG_GENTOO_LINUX_UDEV=y
You can’t perform that action at this time.