Skip to content

Instantly share code, notes, and snippets.

@cattaka
cattaka / rebuild_opencv_so.sh
Created May 25, 2018 07:40
The script for rebuilding OpenCV so files.
#!/bin/sh
cd `dirname $0`/..
PROJECT_ROOT=$PWD
OPENCV_VERSION=3.4.1
if [ "Darwin" = `uname -s` ]; then
HOST_ARCH=macosx
elif [ "Linux" = `uname -s` ]; then
HOST_ARCH=linux
## profile
export HISTSIZE=2000000
export HISTFILESIZE=20000000
export ANDROID_ADB_SERVER_PORT=25037
export JAVA_HOME=${HOME}/opt/android-studio/jre
export ANDROID_HOME=${HOME}/Android/Sdk
export GOROOT=${HOME}/opt/go
export GOPATH=${HOME}
/*
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
/****************************************************************************
*
* This file is for gatt server. It can send adv data, be connected by client.
@cattaka
cattaka / macros.xml
Created April 26, 2018 07:44
My macro for intellij
<application>
<component name="ActionMacroManager">
<macro name="Reformat and Optimize import and Save">
<action id="ReformatCode" />
<action id="OptimizeImports" />
<action id="SaveAll" />
</macro>
</component>
</application>
@cattaka
cattaka / android_studio_swap_key.py
Created April 26, 2018 02:11
Replace all keybind of IntelliJ (including android studio), meta <> control
# Replace all keybind of IntelliJ (including android studio)
# meta <> control
#
# How to use
#
# extract original keymaps from resource.jar
# $ unzip $PATH_TO_INTELLI_J/lib/resources.jar keymaps/\*
# $ python android_studio_swap_key.py -i keymaps/Mac\ OS\ X\ 10.5+.xml -o swapped.xml
import xml.etree.ElementTree as ET
#include<BLEDevice.h>
#include<BLEHIDDevice.h>
BLEServer* gBLEServer;
BLEHIDDevice* gBLEHIDDevice;
BLECharacteristic* gBLECharacteristic;
class MyServerCallbacks: public BLEServerCallbacks {
public:
@cattaka
cattaka / GET_PARAMS_FROM_QUERY_STRING.SQL
Last active December 20, 2017 09:05
GET_PARAMS_FROM_QUERY_STRING for BigQuery
CREATE TEMPORARY FUNCTION GET_PARAMS_FROM_QUERY_STRING(query_str STRING, key_name STRING)
RETURNS STRING
LANGUAGE js AS """
if (query_str == null) { return null; }
var start = 0;
while (0 <= start && start < query_str.length) {
var end = query_str.indexOf('&', start + 1);
if (end < 0) { end = query_str.length }
var p = query_str.indexOf('=', start);
@cattaka
cattaka / dumpheap
Last active October 28, 2017 04:43
Dump Android hprof and convert to hprof for Memory Analyzer
#!/bin/sh
if [ -z "$1" ]; then
echo "USAGE: dumphprof <package_name> [<out_file>]"
exit 1
fi
date=`date '+%Y%m%d%H%M%S'`
temp_file="$1_${date}_orig.hprof"
output_file="$1_${date}.hprof"
/usr/share/X11/xorg.conf.d/70-synaptics.conf
Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
# This option is recommend on all Linux systems using evdev, but cannot be
# enabled by default. See the following link for details:
# http://who-t.blogspot.com/2010/11/how-to-ignore-configuration-errors.html
# MatchDevicePath "/dev/input/event*"
# Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0660", GROUP="plugdev"
# ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0660", GROUP="plugdev"
# Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0660", GROUP="plugdev"
# Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0660", GROUP="plugdev"
# Fujitsu
SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0660", GROUP="plugdev"