Skip to content

Instantly share code, notes, and snippets.

View sphrak's full-sized avatar
🐱
hax

Niclas sphrak

🐱
hax
  • Stockholm, Sverige
  • 08:35 (UTC +01:00)
View GitHub Profile
@sphrak
sphrak / EmojiBg.kt
Created November 18, 2024 16:34 — forked from KlassenKonstantin/EmojiBg.kt
EmojiBg in KMP
@Composable
fun EmojiFont() = FontFamily(
Font(Res.font.noto_emoji_light, FontWeight.Light),
Font(Res.font.noto_emoji_reg, FontWeight.Normal),
Font(Res.font.noto_emoji_med, FontWeight.Medium),
)
val testEmojis =
persistentListOf("🍇", "🍅", "🥬", "🍞", "🧀", "🥚", "🥩", "🍫", "🍕", "🍷", "🧃", "🧼", "🧻", "🧴", "🍏")
@sphrak
sphrak / Moving Gradient
Created November 18, 2024 16:04 — forked from SEAbdulbasit/Moving Gradient
Moving Mesh Gradient
@Composable
fun FluidMeshGradient(
modifier: Modifier = Modifier
) {
val infiniteTransition = rememberInfiniteTransition(label = "gradient")
// Angle animations for smoother movement
val angle1 = infiniteTransition.animateFloat(
initialValue = 0f,
@sphrak
sphrak / DeviceComponent.kt
Created June 16, 2023 08:01
dagger2 desktop jvm
@DeviceScope
@Component(
modules = [
DeviceModule::class
],
dependencies = [
// shared dependencies
AppComponent::class
]
)
@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 / 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 / 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
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 / 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
@sphrak
sphrak / .editorconfig
Created December 24, 2022 23:26
ktlint
[*.{kt,kts}]
# possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)
indent_size=4
# true (recommended) / false
insert_final_newline=false
# possible values: number (e.g. 120) (package name, imports & comments are ignored), "off"
# it's automatically set to 100 on `ktlint --android ...` (per Android Kotlin Style Guide)
max_line_length=off
ktlint_standard_no-empty-first-line-in-method-block=disabled
ktlint_standard_trailing-comma-on-declaration-site=disabled
@sphrak
sphrak / blender.md
Last active August 14, 2022 15:25
blender cheatsheet

keys

move objects

hit g then move freely -- or combine with z, x or y to move along respective axis

deleting objects

hit x