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
import kotlin.reflect.full.findAnnotation
import kotlin.reflect.full.memberProperties
@Target(AnnotationTarget.PROPERTY)
annotation class JsonFileId
interface JsonSerializable
fun JsonSerializable.serialize(): String {
(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?
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
package main
import "fmt"
type ListNode struct {
Val int
Next *ListNode
}
func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode {
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) }
}
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)
<?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">
#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;
#
# 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
#!/bin/sh
if [[ -f /var/cache/.restored ]]
then
rsync -avzh -x /var/cache/ /usr/portage/local/cache > /dev/null 2>/var/log/cache-store.log
fi