Skip to content

Instantly share code, notes, and snippets.

@joinAero
joinAero / install_opencv_on_macos.md
Created May 19, 2017 07:35
Install OpenCV 3 with Python 2.7 (macOS) + OpenNI2 for Kinect

Install OpenCV 3 with Python 2.7 (macOS)

$ brew install python
$ python --version
Python 2.7.13

$ pip install numpy
@joinAero
joinAero / CMakeLists.txt
Last active September 20, 2023 14:11
Use Kinect with OpenCV (C++)
cmake_minimum_required(VERSION 2.8)
project(OCVSamples)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(OpenCV 3.0 QUIET)
if(OpenCV_FOUND)
add_definitions(-DUSE_OPENCV3)
else()
message(FATAL_ERROR "OpenCV > 3.0 not found.")
@joinAero
joinAero / camera.py
Created May 19, 2017 06:36
Use Kinect with OpenCV (Python)
import cv2
import sys
class Camera(object):
def __init__(self, index=0):
self.cap = cv2.VideoCapture(index)
self.openni = index in (cv2.CAP_OPENNI, cv2.CAP_OPENNI2)
self.fps = 0
@joinAero
joinAero / FlymeUtils.java
Created February 17, 2016 13:04
Android - Helper for 3rd party roms: Flyme & MIUI.
package cc.cubone.turbo.core.rom;
import android.os.Build;
import android.view.Window;
import android.view.WindowManager;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
/**
@joinAero
joinAero / TransparentStatusBarActivity.java
Last active September 24, 2022 13:24
Android - Completely transparent status bar.
package cc.cubone.turbo.ui.demo;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.ColorInt;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
@joinAero
joinAero / BuildProperties.java
Created February 17, 2016 06:58
Android - Helper for accessing os properties.
package cc.cubone.turbo.core.os;
import android.os.Environment;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Enumeration;
@joinAero
joinAero / TokenActivity.java
Created January 14, 2016 13:40
Android - Activity for providing resume under the window has been attached.
package cc.cubone.turbo.core.app;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class TokenActivity extends AppCompatActivity {
private boolean mAttached;
/*public boolean isAttached() {
@joinAero
joinAero / SightFragment.java
Created January 14, 2016 13:37
Android - Fragment for handling view after it has been created and visible to user for the first time.
package cc.cubone.turbo.core.app;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.View;
/**
* Fragment for handling view after it has been created and visible to user for the first time.
*
* <p>Specially in {@link android.support.v4.view.ViewPager}, the page will be created beforehand
@joinAero
joinAero / CrashHandler.java
Last active January 13, 2016 13:20
Android - Handles the crash.
package cc.cubone.turbo.core.debug;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import java.io.File;
import java.io.FileOutputStream;
@joinAero
joinAero / BluetoothCallback.java
Last active October 7, 2021 15:42
Android - The bluetooth listener and profile proxy.
package cc.cubone.turbo.core.bluetooth;
/**
* Interface definition for a callback to be invoked when bluetooth state changed.
*/
public interface BluetoothCallback {
/**
* Called when the bluetooth is off.
*/