Skip to content

Instantly share code, notes, and snippets.

@himattm
himattm / build.gradle.kts
Created July 14, 2021 13:44
Fix Jetpack Compose @Preview in release candidate 01
configurations.all {
resolutionStrategy {
force("androidx.compose.ui:ui-tooling:1.0.0-beta09")
force("androidx.compose.ui:ui-tooling-data:1.0.0-beta09")
force("androidx.compose.ui:ui-tooling-preview:1.0.0-beta09")
}
}
@himattm
himattm / St_Answer_Issue_16.kt
Created August 5, 2021 13:41
The answer to the practice question asked in StoicallyTyped Issue 15 and answered in 16
data class Event(val title: String, val day: String)
fun main() {
// Create a list of our events
val events = listOf<Event>(
Event("New StoicallyTyped Newsletter", "Monday"),
Event("Workout", "Monday"),
Event("Conference", "Tuesday"),
Event("@AdamMc331 Streams", "Wednesday"),
Event("Car Wash", "Thursday"),
@himattm
himattm / Issue_24_Practice_Question.kt
Last active October 13, 2021 13:59
Today we have a Kotlin brain teaser! What does this code print?
data class Foo(val i: Int)
fun main() {
val map = mapOf(
1 to Foo(1),
2 to Foo(2),
3 to Foo(3),
)
println("map = $map")
@himattm
himattm / md_image_link_example.md
Last active December 21, 2021 21:17
How to make a clickable image in Markdown
@himattm
himattm / convert_mp4_to_mp3.sh
Created March 7, 2022 19:06
Uses ffmpeg to convert mp4 to mp3 and also truncate silences
#!/bin/bash
for i in *.mp4
do
#ffmpeg -i "$i" "${i%mp4}mp3" # Convert mp4 to mp3
ffmpeg -i "$i" -af silenceremove=stop_periods=-1:stop_duration=1:stop_threshold=-55dB "removed_silence_${i%mp4}mp3"
done