Skip to content

Instantly share code, notes, and snippets.

@rprtr258
rprtr258 / anagram.go
Last active December 8, 2024 17:41
anagram benches
package a
import (
"cmp"
_ "runtime"
"slices"
_ "unsafe"
)
func anagramMap(a, b string) bool {
@rprtr258
rprtr258 / fibonacci.ink
Last active January 18, 2025 11:59
ink std to import
helper := (a, b, n) => n :: {
0 -> a,
_ -> helper(b, a+b, n-1)
}
n => helper(0, 1, n)
@rprtr258
rprtr258 / chans.go
Last active June 30, 2024 15:29
golang coroutines benchmark
package main
import "strings"
func chan_fromstring(input string) <-chan byte {
ch := make(chan byte)
go func() {
for _, c := range input {
ch <- byte(c)
}
@rprtr258
rprtr258 / t_test.go
Last active May 7, 2023 00:09
direct call/interface/function pointer benchmark
package tt
/*
goos: linux
goarch: amd64
cpu: Intel(R) Core(TM) i3-6100U CPU @ 2.30GHz
BenchmarkInterface-4 402143721 2.880 ns/op
BenchmarkTemplate-4 205737126 6.119 ns/op
BenchmarkDirect-4 1000000000 0.5869 ns/op
BenchmarkFunctionPointer-4 166973348 6.738 ns/op
@rprtr258
rprtr258 / main.go
Last active October 12, 2022 11:36
holes count program
package main
import (
"fmt"
"os"
)
var _table = map[rune]int{
// Numbers
'0': 1,
@rprtr258
rprtr258 / main.py
Last active April 20, 2021 12:08
cps
def nop(*args): pass
def f(n, e=lambda f:f()):
print(f"f#{n} started")
def cont(k=nop):
print(f"f#{n} ended")
k()
e(cont)
f(1, lambda cont: f(2, lambda cont2: cont(cont2)))
@rprtr258
rprtr258 / autotest.js
Last active April 26, 2021 22:55
vanuchaya
/*
Автоматическое прохождение проверочных заданий. Просто нажимает все первые ответы и отправляет.
Неправильные ответы можно исправить вручную.
*/
$(".response-label > input[value=choice_0]").click();
$("button.submit").click();
setTimeout(() => {
for (let f of $(".notification.error.notification-submit"))
f.parentNode.querySelector("input[value=choice_1]").click();
$("button.submit").click();
@rprtr258
rprtr258 / 1.csv
Last active November 8, 2019 15:33
flats dataset
METRO_DISTANCE PRICE
677 7328400
120 9754600
1344 6781500
1003 6784100
591 7296200
719 8121900
406 8889400
216 9819000
2497 3924500