Skip to content

Instantly share code, notes, and snippets.

Avatar

Viacheslav Blinov dant3

View GitHub Profile
@dant3
dant3 / hello_x32.s
Last active Aug 3, 2022
Hello world in assembler
View hello_x32.s
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 Nov 20, 2018 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker for Mac Moby VM
View docker-for-mac.md

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 Oct 31, 2018
Fixes problems with Idea+Gradle+Dagger combo then you can't see generated symbols
View dagger.gradle
def generatedMain = new File(buildDir, "generated/main")
compileJava {
doFirst {
generatedMain.mkdirs()
}
options.compilerArgs += ['-s', generatedMain]
}
idea {
@dant3
dant3 / build.gradle.kts
Created Apr 29, 2018 — forked from mkobit/build.gradle.kts
Run Kotlin REPL with built source code and main classpath in Gradle
View build.gradle.kts
// 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 Apr 26, 2018 — forked from thaJeztah/docker-examples.md
Some docker examples
View docker-examples.md

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 Dec 19, 2017 — forked from th3architect/lxc-from-vmdk.sh
create sles lxc container within mounted img from vmdk img.
View lxc-from-vmdk.sh
#!/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 Dec 11, 2017 — forked from calbrecht/lxc-from-vmdk.sh
create sles lxc container within mounted img from vmdk img.
View lxc-from-vmdk.sh
#!/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
View KotlinScriptDemo.kt
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 Aug 4, 2017
Check if kotlin generic is nullable type
View nullable.kt
inline fun <reified T> isNullable(): Boolean = null is T
@dant3
dant3 / # rustup-init - 2017-07-05_22-31-01.txt
Created Jul 5, 2017
rustup-init on Ubuntu 16.04.2 LTS - Homebrew build logs
View # rustup-init - 2017-07-05_22-31-01.txt
Homebrew build logs for rustup-init on Ubuntu 16.04.2 LTS
Build date: 2017-07-05 22:31:01