Skip to content

Instantly share code, notes, and snippets.

View yaroslavkulinich's full-sized avatar

Yaroslav Kulinich yaroslavkulinich

View GitHub Profile
@rharter
rharter / SharedPreferenceLiveData.kt
Last active March 19, 2023 08:15
Creates LiveData objects that observe a value in SharedPreferences while they have active listeners.
import android.arch.lifecycle.LiveData
import android.content.SharedPreferences
abstract class SharedPreferenceLiveData<T>(val sharedPrefs: SharedPreferences,
val key: String,
val defValue: T) : LiveData<T>() {
private val preferenceChangeListener = SharedPreferences.OnSharedPreferenceChangeListener { sharedPreferences, key ->
if (key == this.key) {
value = getValueFromPreferences(key, defValue)
@robobe
robobe / cv2gst_pipe
Created December 31, 2019 20:06
send opencv frame over gstreamer pipe using python # python #gst
#!/usr/bin/env python3
import sys
import os
import cv2
import gi
import signal
import threading
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GObject
@All4Gis
All4Gis / QgsMultiplexorGs
Last active May 16, 2024 15:25
Python code for muxing klv and video (MISB) #STANAG #MISB #UAV
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import os
import gi
# Author : Fran Raga , 2021
# proof of concept to ingest KLV telemetry into a video. Multiplexer concept to create a MISB Video.
# Related with : https://github.com/All4Gis/QGISFMV/blob/master/code/manager/QgsMultiplexor.py
# Get Video width/Height
import androidx.compose.desktop.SwingPanel
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.material.Button
import androidx.compose.material.Text
import androidx.compose.runtime.*
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@Composable
fun AnimatedBorderCard(
modifier: Modifier,
contents: @Composable RowScope.() -> Unit
) {
val containerSize = 200.dp
var offsetFloat by remember { mutableStateOf(0f) }
LaunchedEffect(null) {
delay(100)
offsetFloat = containerSize.value * 10f
import androidx.compose.animation.core.EaseInOut
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
@rodrigomartind
rodrigomartind / SmallDesignToolCompose.kt
Created April 14, 2023 18:53
Small Design Tool in Jetpack Compose
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
@file:OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
package de.kuno.listsections
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateRectAsState
import androidx.compose.foundation.ExperimentalFoundationApi