Skip to content

Instantly share code, notes, and snippets.

View carterhudson's full-sized avatar

Carter Hudson carterhudson

  • Denver, CO
View GitHub Profile
@carterhudson
carterhudson / bootstrap.sh
Last active March 21, 2026 21:27
SlothServ bootstrap — one-command media server setup for macOS
#!/usr/bin/env bash
#
# SlothServ Bootstrap
# Sets up the entire media server stack on a fresh macOS machine.
#
# Usage:
# bash bootstrap.sh # Interactive — prompts for everything
# bash bootstrap.sh --import config.json # Headless — reads saved credentials
# bash bootstrap.sh --export config.json # Snapshot — dumps live stack to file
#
@carterhudson
carterhudson / __init__.py
Last active March 21, 2026 21:45
SlothServ watchdog daemon — automated media server management
"""
SlothServ watchdog daemon.
Run as: python3 -m watchdog (from scripts/)
or: python3 scripts/watchdog (from media-server/)
"""
class PhoneNumberVisualTransformation(locale: Locale = Locale.getDefault()) : VisualTransformation {
private val phoneNumberFormatter =
PhoneNumberUtil.getInstance().getAsYouTypeFormatter(locale.country)
override fun filter(text: AnnotatedString): TransformedText {
phoneNumberFormatter.clear()
var formatted = ""
@Composable
private fun BottomNavigationBar(
modifier: Modifier = Modifier,
currentDestination: Screen,
onClick: (id: Screen) -> Unit
) {
val bottomBarVisible = bottomBarNavDestinations.contains(currentDestination)
AnimatedVisibility(
data class NutritionDateWithFoodItemsEntity(
@Embedded val nutritionDate: NutritionDateEntity,
@Relation(
parentColumn = "epochDay",
entityColumn = "createdAt",
associateBy = Junction(NutritionDateAndFoodItemCrossRefEntity::class)
)
val foodItems: List<FoodItemEntity>
)
fun Modifier.repeatingClickable(
interactionSource: MutableInteractionSource,
enabled: Boolean,
maxDelayMillis: Long = 1000,
minDelayMillis: Long = 5,
delayDecayFactor: Float = .20f,
onClick: () -> Unit
): Modifier = composed {
val currentClickListener by rememberUpdatedState(onClick)
@Preview
@Composable
fun CustomRepeatingButton() {
Box(modifier = Modifier.fillMaxSize()) {
var repeatCount by remember { mutableStateOf(0) }
val interactionSource = remember { MutableInteractionSource() }
Surface(
modifier = Modifier
.repeatingClickable(
fun Modifier.repeatingClickable(
interactionSource: InteractionSource,
enabled: Boolean,
maxDelayMillis: Long = 1000,
minDelayMillis: Long = 5,
delayDecayFactor: Float = .20f,
onClick: () -> Unit
): Modifier = composed {
val currentClickListener by rememberUpdatedState(onClick)
@Composable
fun RepeatingButton(
modifier: Modifier = Modifier,
onClick: () -> Unit,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
elevation: ButtonElevation? = ButtonDefaults.elevation(),
shape: Shape = MaterialTheme.shapes.small,
border: BorderStroke? = null,
colors: ButtonColors = ButtonDefaults.buttonColors(),
@Composable
fun RepeatingButton(
modifier: Modifier = Modifier,
onClick: () -> Unit,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
elevation: ButtonElevation? = ButtonDefaults.elevation(),
shape: Shape = MaterialTheme.shapes.small,
border: BorderStroke? = null,
colors: ButtonColors = ButtonDefaults.buttonColors(),