Skip to content

Instantly share code, notes, and snippets.

View sphrak's full-sized avatar
🐱
hax

Niclas sphrak

🐱
hax
  • Stockholm, Sverige
  • 05:07 (UTC +02:00)
View GitHub Profile
@sphrak
sphrak / MessageService.kt
Last active January 6, 2023 14:03
ktor websocket flow retry mechanism
@Serialized
data class MessageDto(
@SerialName(value = "id")
val id: String,
@SerialName(value = "message")
val message: String
)
class MessageService constructor(
private val httpClient: HttpClient
import android.graphics.Matrix
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
@sphrak
sphrak / gstreamer.md
Last active January 10, 2023 18:43
gstreamer commands

http streaming

authorized flac/mp3 streaming command with 50% vol

./Library/Frameworks/GStreamer.framework/Versions/1.0/bin/gst-launch-1.0 souphttpsrc location="https://example.tld/v1/stream/YjEyMDA1NDAtYzNlZS00NmQ2LTg2OTEtOTlkMjAyYjU2NGIy" extra-headers="test, Authorization=(string)\"<ACCESS_TOKEN>\"" ! decodebin ! audioconvert ! audioresample ! volume volume=0.5 ! autoaudiosink
@sphrak
sphrak / ColoredShadow.kt
Created January 25, 2023 15:38 — forked from tasjapr/ColoredShadow.kt
Draw a colored shadow in Android Jetpack Compose
/*
Copyright 2020 Cedric Kring.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@sphrak
sphrak / pihole.md
Last active March 30, 2023 18:27
pihole

Deploy pihole in docker

  • pull
  • tear down
  • re-deploys pihole

Requirements

  • requires root to execute if docker daemon runs as root
@sphrak
sphrak / DeviceComponent.kt
Created June 16, 2023 08:01
dagger2 desktop jvm
@DeviceScope
@Component(
modules = [
DeviceModule::class
],
dependencies = [
// shared dependencies
AppComponent::class
]
)