Skip to content

Instantly share code, notes, and snippets.

View chris-piekarski's full-sized avatar

Christopher Piekarski chris-piekarski

  • Boulder, CO
  • 13:26 (UTC)
View GitHub Profile
alias randman='dir="/bin"; man $(ls $dir |sed -n "$(echo $(( $RANDOM % $(ls $dir |wc -l | awk "{ print $1; }" ) + 1 )) )p")'
@chris-piekarski
chris-piekarski / build_opencv_ARM_cross
Created March 23, 2020 05:05 — forked from hrshovon/build_opencv_ARM_cross
Cross compile opencv3.3.0 for your raspberry pi and similar ARM devices with python support
This is a note on how to cross compile opencv for pretty much any ARM device(HardFP supported in this case) and deploy. Native
compiling in ARM devices can be painfully slow and they seem to hang often during build(mine got stuck at 43%). So if you happen
to have a desktop/laptop/server running ubuntu or similar linux distro, u can build opencv in fractionth of the time taken for
native compiling without any issues.
Building opencv3 with TBB and NEON and VFP support can boost opencv performance. Thanks to Adrian at pyimagesearch for pointing
that out.
Both my PC and target machine aka orange pi zero are running ubuntu 16.04 with python2.7 and python 3.5.
Let us use the term "build machine" for your PC where you are building opencv and "target machine" for the ARM single board computer.
1.Run the following commands in both machines(I think installing these in target machine only would do) to install the necessary libraries etc.(mine worked with them,so they should be enough
@chris-piekarski
chris-piekarski / repo_forall_path_example
Last active May 28, 2019 16:25
List remote project and local paths using Android repo script.
repo forall -c 'echo $REPO_PROJECT $REPO_PATH'
platform/abi/cpp abi/cpp
platform/bionic bionic
device/fsl/bootloader/uboot bootable/bootloader/uboot-imx
platform/bootable/recovery bootable/recovery
platform/build build
platform/cts cts
platform/dalvik dalvik
@chris-piekarski
chris-piekarski / git_pull_sub_repos
Last active May 28, 2019 16:24
Git Pull Multiple Subdirectory Repos
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git pull" \;
@chris-piekarski
chris-piekarski / size_up_tensorflow
Created January 31, 2019 00:53
current line count for tensorflow
1/30/2019
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rglob
>>> rglob.lcount("/media/chris/UBNT/tensorFlowExample/tensorflow","*.py")
3268693
>>> rglob.lcount("/media/chris/UBNT/tensorFlowExample/tensorflow","*.java")
245116
@chris-piekarski
chris-piekarski / basic_file_nano_template
Last active November 26, 2018 22:57
Using NanoHTTPD in Android
Add your index.html file to res/raw
Add dep to app gradle file:
dependencies {
implementation 'org.nanohttpd:nanohttpd-webserver:2.3.1'
}
Java class file:
import fi.iki.elonen.NanoHTTPD;
@chris-piekarski
chris-piekarski / gist:78284318cbad31d7fb92f8200213cec9
Created August 24, 2018 20:49
GPLv2 Git Patch Sharing Stripper
#create patches from author(s) into one without comments
#good for GPLv2 sharing
for c in `git log --format=format:%H --author=chris`;do git format-patch --stdout --format=format:%H --no-stat -1 $c;done | tee stuff.patch
@chris-piekarski
chris-piekarski / bash_pic_convert
Created April 22, 2018 03:30
Convert images to 720p
for f in ./*.*;do convert -resize 1280x720 $f ./720p/$f; done
@chris-piekarski
chris-piekarski / repo_grep_logs_by_author
Last active February 27, 2018 19:08
Grep all AOSP repos commit messages by author
repo forall -c git log --grep="partition" --author=Chris
repo forall -c 'echo $REPO_PATH; git log --grep "partition" --author=Chris'
@chris-piekarski
chris-piekarski / cli_vs_filereader
Created February 1, 2017 23:13
Android read file types
//1ms but uses file cache so not updated quickly
try {
String inputLine;
FileReader file = new FileReader("/sys/class/power_supply/battery/current_now");
BufferedReader bufferedReader = new BufferedReader(file);
inputLine = bufferedReader.readLine();
text = inputLine;
bufferedReader.close();
file.close();
} catch (Exception e) {