Skip to content

Instantly share code, notes, and snippets.

View dant3's full-sized avatar

Viacheslav Blinov dant3

View GitHub Profile
@dant3
dant3 / MarkdownComposer.kt
Created November 22, 2023 12:16 — forked from ErikHellman/MarkdownComposer.kt
A simple rendered for Markdown text parsed using CommonMarks
package se.hellsoft.markdowncomposer
import android.util.Log
import androidx.compose.foundation.Box
import androidx.compose.foundation.ContentGravity
import androidx.compose.foundation.Text
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.appendInlineContent
import androidx.compose.material.Colors
@dant3
dant3 / hello_x32.s
Last active August 3, 2022 09:12
Hello world in assembler
segment .text ;code segment
global _start ;must be declared for linker
_start: ;tell linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
@dant3
dant3 / docker-for-mac.md
Created November 20, 2018 16:26 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker for Mac Moby VM

2018 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Moby VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@dant3
dant3 / dagger.gradle
Last active October 31, 2018 16:07
Fixes problems with Idea+Gradle+Dagger combo then you can't see generated symbols
def generatedMain = new File(buildDir, "generated/main")
compileJava {
doFirst {
generatedMain.mkdirs()
}
options.compilerArgs += ['-s', generatedMain]
}
idea {
@dant3
dant3 / build.gradle.kts
Created April 29, 2018 05:30 — forked from mkobit/build.gradle.kts
Run Kotlin REPL with built source code and main classpath in Gradle
// Assuming Kotlin plugin is applied...
// Run as: ./gradlew kotlinRepl --console plain --no-daemon
val kotlinRepl by tasks.creating {
description = "Starts Kotlin REPL with compiled main classes and runtime classpath"
val mainSourceSet = java.sourceSets["main"]
dependsOn(mainSourceSet.output)
doFirst {
val buildscriptClasspath = rootProject.buildscript.configurations["classpath"]
@dant3
dant3 / docker-examples.md
Created April 26, 2018 13:21 — forked from thaJeztah/docker-examples.md
Some docker examples

Commit, clone a container

To 'clone' a container, you'll have to make an image of that container first, you can do so by "committing" the container. Docker will (by default) pause all processes running in the container during commit to preserve data-consistency.

For example;

docker commit --message="Snapshot of my container" my_container my_container_snapshot:yymmdd
@dant3
dant3 / lxc-from-vmdk.sh
Created December 19, 2017 11:56 — forked from th3architect/lxc-from-vmdk.sh
create sles lxc container within mounted img from vmdk img.
#!/usr/bin/env bash
test 0 != $(id -u) && { echo "sudo ${0} ${@}"; sudo ${0} ${@} && exit 0 || exit 1; }
BOX_NAME=sles11sp3
AUTOINST=https://raw.githubusercontent.com/jedi4ever/veewee/master/templates/SLES-11-SP3-DVD-x86_64-GM/autoinst.xml
BOX_HOME=${HOME}/.vagrant.d/boxes/${BOX_NAME}/0/virtualbox
BOX_VMDK=${BOX_HOME}/box-disk1.vmdk
@dant3
dant3 / lxc-from-vmdk.sh
Created December 11, 2017 15:59 — forked from calbrecht/lxc-from-vmdk.sh
create sles lxc container within mounted img from vmdk img.
#!/usr/bin/env bash
test 0 != $(id -u) && { echo "sudo ${0} ${@}"; sudo ${0} ${@} && exit 0 || exit 1; }
BOX_NAME=sles11sp3
AUTOINST=https://raw.githubusercontent.com/jedi4ever/veewee/master/templates/SLES-11-SP3-DVD-x86_64-GM/autoinst.xml
BOX_HOME=${HOME}/.vagrant.d/boxes/${BOX_NAME}/0/virtualbox
BOX_VMDK=${BOX_HOME}/box-disk1.vmdk
@dant3
dant3 / KotlinScriptDemo.kt
Created November 23, 2017 11:27
KotlinScriptDemo
import javax.script.ScriptEngine
import javax.script.ScriptEngineManager
import kotlin.system.exitProcess
fun ScriptEngine.bindVal(name: String, type: String, value: Any) {
put(name, value)
eval("val $name = bindings[\"$name\"] as $type")
}
@dant3
dant3 / nullable.kt
Created August 4, 2017 12:38
Check if kotlin generic is nullable type
inline fun <reified T> isNullable(): Boolean = null is T