Skip to content

Instantly share code, notes, and snippets.

View dant3's full-sized avatar

Viacheslav Blinov dant3

View GitHub Profile
@dant3
dant3 / # rustup-init - 2017-07-05_22-31-01.txt
Created July 5, 2017 19:43
rustup-init on Ubuntu 16.04.2 LTS - Homebrew build logs
Homebrew build logs for rustup-init on Ubuntu 16.04.2 LTS
Build date: 2017-07-05 22:31:01
@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"
@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 / 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 / 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 / wercker.yml
Created May 4, 2016 16:05
Wercker based ci configuration for sbt-android
box: dant3/android
build:
steps:
- script:
name: install sbt-launcher
code: |
curl -o sbt-launcher.sh https://raw.githubusercontent.com/paulp/sbt-extras/master/sbt
chmod a+x ./sbt-launcher.sh
- script:
name: start emulator for tests
@dant3
dant3 / travis.yml
Created May 4, 2016 15:44
sbt-android initial travis.yml
language: android
os:
- linux
jdk:
- oraclejdk8
cache:
directories:
- $HOME/.m2/repository
- $HOME/.sbt
- $HOME/.ivy2
@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
@dant3
dant3 / LogstashService.java
Last active July 21, 2021 06:43
Logstash Android client
import android.app.AlarmManager;
import android.app.IntentService;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import java.io.*;
import java.net.*;
@dant3
dant3 / adbwifi.sh
Last active September 9, 2015 09:37
ADB over wifi
#!/bin/bash
PORT=5555
echo "Getting device ip..."
PHONE_IP=`adb shell ip -f inet addr show wlan0 | grep inet | cut -d: -f2 | awk '{ print $2 }' | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"`
echo "Device ip: $PHONE_IP"
echo "Enabling adb tcpip on port $PORT"
adb tcpip $PORT
echo "adb tcpip enabled. Connecting..."
adb connect $PHONE_IP:$PORT
echo "Adb over wifi connected. Now you can remove your usb cable."