Skip to content

Instantly share code, notes, and snippets.

@nat-418
nat-418 / a-sensible-nixos-xfce-configuration.md
Last active June 16, 2024 13:10
A sensible NixOS Xfce configuration

A sensible NixOS Xfce Configuration

NixOS provides good support for the Xfce desktop environment out-of-the-box, but the defaults are minimal. The files in this Gist provide a more complete experience, including a suite of basic software and plugins as well as an optional home-manager configuration for theming.

The key additions to the default Xfce provided by NixOS are:

  • Complete bluetooth / audio support with panel indicators and apps
  • LightDM with theme
  • Extra Xfce apps for calendaring, disk partitioning, etc.
  • Various quality-of-life improving non-essentials
@marcelpinto
marcelpinto / ImageGlanceWidget.kt
Created November 8, 2022 11:36
ImageGlanceWidget using recomposition + coil
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
import android.content.Context
import android.graphics.Bitmap
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@KONFeature
KONFeature / ComposeOverlayViewService.kt
Created June 28, 2022 21:34
Service ready to display complete view (with the right context to access the window manager and layout inflater if needed, but also access to a saved state registry and a view model store owner). Then a compose overlay service, that use the first one to push a compose view as system overlay, and also proposing a simple draggable box that can be …
import android.content.Intent
import android.graphics.PixelFormat
import android.os.IBinder
import android.view.Gravity
import android.view.WindowManager
import androidx.compose.foundation.gestures.detectDragGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
1. Download Git Bash (only if on Windows)
2. Go to your users folder and open the .ssh folder. Then open Git Bash / Terminal there and generate a key pair:
ssh-keygen -m PEM -t rsa
3. Copy the key to your server:
ssh-copy-id -i <keyname> <user>@<host>
5. Login to your Ubuntu server via SSH:
ssh -i <keyname> <user>@<host>
@handstandsam
handstandsam / MyLifecycleOwner.kt
Last active July 13, 2024 05:35
Jetpack Compose OverlayService. You have to have all the correct permissions granted and in your manifest, but if you do, this this will show a green box with "Hello" in it!
import android.os.Bundle
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleRegistry
import androidx.savedstate.SavedStateRegistry
import androidx.savedstate.SavedStateRegistryController
import androidx.savedstate.SavedStateRegistryOwner
internal class MyLifecycleOwner : SavedStateRegistryOwner {
private var mLifecycleRegistry: LifecycleRegistry = LifecycleRegistry(this)
private var mSavedStateRegistryController: SavedStateRegistryController = SavedStateRegistryController.create(this)
@prof18
prof18 / JetpackComposeDatePicker.kt
Last active October 17, 2022 08:56
A simple Date Picker for Jetpack Compose, waiting for the official one
import androidx.compose.foundation.Text
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@pfmaggi
pfmaggi / ConferenceDataWorkerFactory.kt
Created March 31, 2020 17:50
Code for the Medium article: "Customizing WorkManager"
/* Copyright 2019 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
class ConferenceDataWorkerFactory(
private val refreshEventDataUseCase: RefreshConferenceDataUseCase
) : WorkerFactory() {
override fun createWorker(
appContext: Context,
workerClassName: String,
workerParameters: WorkerParameters
@Qualifier
annotation class MainCoroutineScope
@Module
object CoroutineScopeModule {
@Provides
@MainCoroutineScope
fun provideMainCoroutineScope(): CoroutineScope = CoroutineScope(Job() + Dispatchers.Main)
@felix19350
felix19350 / ktor-full-example.kt
Last active July 15, 2023 12:42
Barebones Ktor REST API example
package org.example
import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
import io.ktor.application.call
import io.ktor.http.HttpStatusCode
import io.ktor.request.receive
import io.ktor.response.respond
import io.ktor.routing.Route
import io.ktor.routing.get
@fnky
fnky / ANSI.md
Last active July 23, 2024 17:28
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27