Skip to content

Instantly share code, notes, and snippets.

View bkahlert's full-sized avatar
😷

Björn Kahlert bkahlert

😷
View GitHub Profile
@bkahlert
bkahlert / copy-out.sh
Last active August 24, 2021 10:08
POSIX script to access EXT4 partitions in img files
#!/bin/sh
# Abort script at first error, when a command exits with non-zero status
# (except in until or while loops, if-tests, list constructs)
set -e
# Attempt to use undefined variable outputs error message, and forces an exit
set -u
# Similar to verbose mode (-v), but expands commands
#set -x
@dotCipher
dotCipher / idea.sh
Created July 26, 2018 22:00
Intellij idea launcher script, that can handle multiple inputs
#!/bin/sh
# Determine where intellij is installed
DEFAULT_IDEA_TOOLBOX_LOCATION=$(ls -1d ~/Library/Application\ Support/JetBrains/Toolbox/apps/*/*/*/IntelliJ\ IDEA.app 2>&1 | tail -n1)
DEFAULT_IDEA_LOCATION=$(ls -1d /Applications/IntelliJ\ IDEA.app 2>&1 | tail -n1)
IDEA=""
if [[ $DEFAULT_IDEA_TOOLBOX_LOCATION = *"No such file or directory"* ]]; then
IDEA="$DEFAULT_IDEA_LOCATION"
elif [[ $DEFAULT_IDEA_LOCAITON = *"No such file or directory"* ]]; then
@Takhion
Takhion / MultiReceiver.kt
Created July 8, 2018 15:52
Multiple receivers in Kotlin
val sample: (X, Y, Z) -> Int = multiReceiver { { { x + y + z } } }
fun <A, B, C, R> multiReceiver(f: A.() -> B.() -> C.() -> R) = { a: A, b: B, c: C -> f(a)(b)(c) }
class X(val x: Int)
class Y(val y: Int)
class Z(val z: Int)
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active April 16, 2024 20:25
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux