This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ComposeSample.xcodeproj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
PVE delte local-lvm partition | |
Reference: https://post.smzdm.com/p/awkv4pq4/ | |
lvremove pve/data | |
lvextend -l +100%FREE -r pve/root | |
Datacenter >> remove `local-lvm` partition >> edit `local` >> select all options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** This script will migrate MTVehicles resource pack to Oraxen | |
* This will include: | |
* - Fixing ItemFrame position of the models | |
* - Fix new texture folder that will not anymore bem on custom/cars/, instead it will be at default/mtvehicles | |
* - For each model that is only a texture replacement, it will generate an Orxen config with Generate enabled with the given name. So... no more bunch of Cars models with only texture change | |
* - Will remove from models the: "particle": "items/particle" and "texture": "items/texture", that Oraxen says is not proper format. | |
*/ | |
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.MutableSharedFlow | |
import kotlinx.coroutines.flow.onStart | |
import kotlinx.serialization.KSerializer | |
import kotlinx.serialization.json.Json | |
import kotlinx.serialization.serializer | |
import java.util.UUID | |
public interface Storage<T : Any> { | |
public suspend fun store(container: T?) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main(args: Array<String>) { | |
val generatedWithGenericCount = 16 | |
fun generateWithFunction(contextsCount: Int): String { | |
val generics = (1..contextsCount).map { "T$it" }.joinToString(", ") | |
val params = (1..contextsCount).map { "param$it: T$it" }.joinToString(",\n") | |
val contexts = "context(" + (1..contextsCount).map { "T$it" }.joinToString(", ") + ")" | |
val withBlocks = (1..contextsCount).map { "with(param$it){" }.joinToString(" ") | |
val withBlocksEnd = (1..contextsCount).map { "}" }.joinToString(" ") | |
return """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public inline fun <reified T : R, R : Any, C : Any> PagingData<T>.insertSectionHeader( | |
crossinline sectionBy: suspend (T) -> C, | |
crossinline insert: suspend (T) -> R, | |
): PagingData<R> { | |
return insertSeparators { first: T?, second: T? -> | |
if(first == null && second != null) | |
return@insertSeparators insert(second) | |
if(second == null) return@insertSeparators null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@file:DependsOn("com.github.hypfvieh:dbus-java-core:4.0.0") | |
@file:DependsOn("com.github.hypfvieh:dbus-java-transport-jnr-unixsocket:4.0.0") | |
@file:DependsOn("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.0") | |
import org.freedesktop.dbus.annotations.DBusInterfaceName | |
import org.freedesktop.dbus.connections.impl.DBusConnection | |
import org.freedesktop.dbus.interfaces.DBusInterface | |
import org.freedesktop.dbus.types.Variant | |
val connection = DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class Either<out L, out R> { | |
class Left<L>(val value: L) : Either<L, Nothing>() | |
class Right<R>(val value: R) : Either<Nothing, R>() | |
fun fold( | |
onLeft: (L) -> Unit, | |
onRight: (R) -> Unit, | |
) { | |
when(this) { | |
is Left -> onLeft(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val window = TestComposeWindow(width = 1024, height = 300) | |
window.setContent { | |
MainUi() | |
} | |
File(Paths.get("").toAbsolutePath().toString()).writeBytes(window.surface.makeImageSnapshot().encodeToData()!!.bytes) | |
} | |
@Composable | |
fun MainUi() { |
NewerOlder