Skip to content

Instantly share code, notes, and snippets.

@toori67
toori67 / adbwifi.sh
Last active November 1, 2019 09:31
Android adb wifi debug shell script.
#!/bin/bash
adb kill-server
adb start-server
echo "Connect device with usb cable"
adb wait-for-device
ANDROID_IP=`adb shell ifconfig wlan0 | awk '/inet addr/ {gsub("addr:", "", $2); print $2}'`
adb tcpip 5555
adb connect $ANDROID_IP:5555
@toori67
toori67 / buildspec_with_coverage.yml
Created July 29, 2018 13:14
build spec with coverage
version: 0.2
phases:
pre_build:
commands:
build:
commands:
- echo Build started on `date`
- ./gradlew clean check assembleDebug
@toori67
toori67 / build_with_jacoco.gradle
Last active July 29, 2018 12:56
build.gradle with jacoco
...
apply plugin: 'kotlin'
apply plugin: "jacoco"
...
jacocoTestReport {
group = "Reporting"
reports {
@toori67
toori67 / buildspec_without_coverage.yml
Last active July 29, 2018 12:43
aws codebuild build spec yml without coverage
version: 0.2
phases:
pre_build:
commands:
build:
commands:
- echo Build started on `date`
- ./gradlew clean check assembleDebug
post_build:
@toori67
toori67 / Dockerfile
Last active July 29, 2018 13:23
Gist for android docker build image
FROM ubuntu:16.04
# Never ask for confirmations
ENV DEBIAN_FRONTEND noninteractive
# Update apt-get
RUN rm -rf /var/lib/apt/lists/* && \
apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y \
@toori67
toori67 / complex_class_to_dict.py
Created March 26, 2017 06:48
Complex class to dict
def to_dict(obj):
if not hasattr(obj, "__dict__"):
return obj
result = {}
for key, val in obj.__dict__.items():
if key.startswith("_"):
continue
element = []
if isinstance(val, list):
for item in val:
@toori67
toori67 / simple_class_to_dict.py
Created March 25, 2017 17:58
Simple class to dict
class Foo:
def __init__(self):
self.a = 10
self.b = 'simple'
def to_dict(obj):
return obj.__dict__
def to_dict2(obj):
d = {}
@toori67
toori67 / mvvm.java
Created March 14, 2017 16:41
android mvvm
interface ICommand {
String getKey();
void onChange(Map<String, Object> props);
}
class NotifyTextView extends TextView implements ICommand {
...
@Override
@toori67
toori67 / descriptor_simple_hashing.py
Created December 6, 2016 10:33
sift descriptor simple binary hashgin
import numpy as np
def to_mean_binary(x, mean):
return 0 if x >= mean else 1
binary_vectorize = np.vectorize(to_mean_binary)
def array_binary_sampling(x, step=4):
sampled = x[0::step]
return binary_as_word(binary_vectorize(sampled, sampled.mean()))
@toori67
toori67 / pool_sift.py
Created December 6, 2016 09:06
Python + opencv sift multiprocessing
from multiprocessing import Pool
import glob
import os
import sys
import cv2
_sift = cv2.SIFT()
def print_surf(folder, is_bulk=True):
extensions = ("*.jpg", "*.jpeg")