Skip to content

Instantly share code, notes, and snippets.

View Szer's full-sized avatar

Ayrat Hudaygulov Szer

View GitHub Profile
@Szer
Szer / appsettings.json
Created June 1, 2024 08:51
keycloak example
{
"Keycloak": {
"realm": "master",
"auth-server-url": "http://localhost:8080/",
"ssl-required": "none",
"resource": "test",
"verify-token-audience": false,
"credentials": {
"secret": "BuIpbumh0dAX8oaRP83MctDtIXQk28GC"
},
started 1
Finished 1
started 2
Finished 2
started 3
started 4
Finished 3
Finished 4
started 5
Finished 5
@Szer
Szer / test.kt
Last active February 2, 2024 22:03
package bug
import java.lang.reflect.ParameterizedType
abstract class Bar<T> {
val type: java.lang.reflect.Type
init {
val superClass = javaClass.genericSuperclass
type = (superClass as ParameterizedType).actualTypeArguments[0]
@Szer
Szer / advent2023-9.fs
Last active December 11, 2023 12:55
Advent of Code 2023 9
let input = """0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45""" |> fun x -> x.Split("\n")
let parse (input:string[]) =
input
|> Array.map (fun x -> x.Split(" ") |> Array.map int)
let rec extrapolateSequence (sequence: int[]) =
let diffs =
@Szer
Szer / advent2023-8.fs
Created December 8, 2023 13:25
Advent of Code 2023 8
open System
let input =
"""LLR
AAA = (BBB, BBB)
BBB = (AAA, ZZZ)
ZZZ = (ZZZ, ZZZ)"""
|> fun x -> x.Split('\n')
@Szer
Szer / advent2023-7.fs
Last active December 7, 2023 16:59
Advent of Code 2023 7
let input2 = """32T3K 765
T55J5 684
KK677 28
KTJJT 220
QQQJA 483""" |> fun x -> x.Split('\n') // 6440
let cardPower isPart1 = function
| 'A' -> 0xE
| 'K' -> 0xD
| 'Q' -> 0xC
@Szer
Szer / advent2023-6.fs
Last active December 7, 2023 16:58
Advent of Code 2023 6
open System
let input = """Time: 7 15 30
Distance: 9 40 200""" |> (fun s -> s.Split('\n', StringSplitOptions.RemoveEmptyEntries))
type Race =
{ time : int64
distance : int64 }
let splitInts (s: string) = s.Split([|' '|], StringSplitOptions.RemoveEmptyEntries) |> Array.map int
@Szer
Szer / advent2023-5.fs
Created December 6, 2023 15:20
Advent of Code 2023 4
open System
type Rule =
{ srcStart: int64
destStart: int64
length: int64 }
member this.offset = this.destStart - this.srcStart
member this.srcFinish = this.srcStart + this.length - 1L
member this.destFinish = this.destStart + this.length - 1L
@Szer
Szer / advent2023-4.fs
Created December 4, 2023 16:39
Advent of Code 2023 4
open System
let input = [|
"Card 1: 41 48 83 86 17 | 83 86 6 31 17 9 48 53"
"Card 2: 13 32 20 16 61 | 61 30 68 82 17 32 24 19"
"Card 3: 1 21 53 59 44 | 69 82 63 72 16 21 14 1"
"Card 4: 41 92 73 84 69 | 59 84 76 51 58 5 54 83"
"Card 5: 87 83 26 28 32 | 88 30 70 12 93 22 82 36"
"Card 6: 31 18 13 56 72 | 74 77 10 23 35 67 36 11"
|]
@Szer
Szer / advent2023-3.fs
Last active December 4, 2023 16:17
Advent of Code 2023 3
open System
let input = [|
"467..114.."
"...*......"
"..35..633."
"......#..."
"617*......"
".....+.58."
"..592....."
"......755."