Skip to content

Instantly share code, notes, and snippets.

View dant3's full-sized avatar

Viacheslav Blinov dant3

View GitHub Profile
@dant3
dant3 / type-bounds.scala
Created September 29, 2015 22:08 — forked from retronym/type-bounds.scala
Tour of Scala Type Bounds
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
apply plugin: "java"
apply plugin: "eclipse"
repositories {
mavenCentral()
}
dependencies {
compile (
"org.jboss.netty:netty:latest.integration",
@dant3
dant3 / mvncolor.sh
Created October 24, 2013 06:46 — forked from katta/mvncolor.sh
#!/usr/bin/env bash
# Formatting constants
export BOLD=`tput bold`
export UNDERLINE_ON=`tput smul`
export UNDERLINE_OFF=`tput rmul`
export TEXT_BLACK=`tput setaf 0`
export TEXT_RED=`tput setaf 1`
export TEXT_GREEN=`tput setaf 2`
export TEXT_YELLOW=`tput setaf 3`
@dant3
dant3 / Jsson.scala
Created November 11, 2013 21:25 — forked from kmizu/Jsson.scala
import scala.util.DynamicVariable
/**
* A concise JSON DSL in Scala.
* When you want to use, only
* import Jsson._ is needed.
* Note that this program change the semantics of standard -&gt; operator.
* I recommend that you use enclosing block with Jsson as followings:
* {
* import Jsson._
* val obj = %{
#!/bin/sh
# gclient can be found here:
# git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
# don't forget modify .bashrc:
# export PATH="$PATH":`pwd`/depot_tools
function fetch() {
echo "-- fetching webrtc"
@dant3
dant3 / InterruptibleCancellableFuture.scala
Created July 15, 2016 09:48 — forked from viktorklang/InterruptibleCancellableFuture.scala
Interruptible-Cancellable-scala.concurrent.Future
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 / 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.
/*
* 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 / mvncolor.sh
Last active January 9, 2017 04:57 — forked from katta/mvncolor.sh
#!/usr/bin/env bash
# Formatting constants
BOLD=`tput bold`
UNDERLINE_ON=`tput smul`
UNDERLINE_OFF=`tput rmul`
TEXT_BLACK=`tput setaf 0`
TEXT_RED=`tput setaf 1`
TEXT_GREEN=`tput setaf 2`
TEXT_YELLOW=`tput setaf 3`
@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

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 / 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
# 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"