Skip to content

Instantly share code, notes, and snippets.

Avatar

Viacheslav Blinov dant3

View GitHub Profile
@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
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 / 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
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 April 26, 2018 13:21 — 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 December 19, 2017 11:56 — 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 December 11, 2017 15:59 — 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
@dant3
dant3 / gist:3989846b10aaafeca3e0af9c94b0626e
Created April 11, 2017 20:28 — forked from rriley/gist:ce38ab20532c1d7a2667
A script to use the Android ART compiler to generate x86 binaries from apk files. Tested with Android 5.1.1_r4
View gist:3989846b10aaafeca3e0af9c94b0626e
# How to use ART to compile arm oat files on the host:
# - Get source code according to https://source.android.com/source/downloading.html
# - source build/envsetup.sh
# - mm build-art
# - Use this script in the source root directory to compile APKs
CWD=`pwd`
export ANDROID_DATA="${CWD}/out/host/datadir/dalvik-cache/x86_64"
export ANDROID_ROOT="${CWD}/out/host/linux-x86"
BOOT_IMAGE="${CWD}/out/host/linux-x86/framework/core.art"
@dant3
dant3 / setup port forwarding to enable remote debugging in vagrant vm.md Getting the remote debugger to work with a java process running in a vagrant vm
View setup port forwarding to enable remote debugging in vagrant vm.md

Vagrant vm network config

In the Vagrantfile, do :

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  config.vm.network :public_network
@dant3
dant3 / NativeFileDialog.java
Created November 10, 2016 20:45 — forked from shannah/NativeFileDialog.java
Example native file dialog for OS X. Uses the Objective-C Cocoa Bridge (https://github.com/shannah/Java-Objective-C-Bridge) and Foxtrot (http://foxtrot.sourceforge.net/) for modal dialogs.
View NativeFileDialog.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ca.weblite.cocoa.ui;
import ca.weblite.objc.NSObject;
import ca.weblite.objc.Proxy;
import java.awt.FileDialog;
import static ca.weblite.objc.RuntimeUtils.msg;
@dant3
dant3 / InterruptibleCancellableFuture.scala
Created July 15, 2016 09:48 — forked from viktorklang/InterruptibleCancellableFuture.scala
Interruptible-Cancellable-scala.concurrent.Future
View InterruptibleCancellableFuture.scala
import scala.concurrent._
def interruptableFuture[T](fun: Future[T] => T)(implicit ex: ExecutionContext): (Future[T], () => Boolean) = {
val p = Promise[T]()
val f = p.future
val lock = new Object
var currentThread: Thread = null
def updateCurrentThread(newThread: Thread): Thread = {
val old = currentThread
currentThread = newThread
@dant3
dant3 / type-bounds.scala
Created September 29, 2015 22:08 — forked from retronym/type-bounds.scala
Tour of Scala Type Bounds
View type-bounds.scala
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x