Skip to content

Instantly share code, notes, and snippets.

View techwizrd's full-sized avatar

Kunal K. Sarkhel techwizrd

View GitHub Profile
@techwizrd
techwizrd / gist:f23539e43d5920a77ac10ddaa570172d
Last active October 9, 2016 02:52
Access fine location Android
private boolean hasLocationPermissions() {
return ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManger.PERMISSION_GRANTED;
}
private void requestLocationPermission() {
if (!ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.ACCESS_FINE_LOCATION) {
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.ACCESS_FINE_LOCATION});
}
}

Keybase proof

I hereby claim:

  • I am techwizrd on github.
  • I am ksarkhel (https://keybase.io/ksarkhel) on keybase.
  • I have a public key whose fingerprint is DF80 EA1D 1D53 D912 C2E7 34DA D554 8805 16CE 02F9

To claim this, I am signing this object:

<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
version="0a90d6dde6cedcc98c1f5663798ffde32831d864"
echo "Downloading OpenCV from Git"
git clone https://github.com/Itseez/opencv.git
echo "Checking out commit " $version
git checkout $version
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libtiff4-dev libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils ffmpeg
echo "Building OpenCV from Git"
@techwizrd
techwizrd / instal_opencv.sh
Created November 21, 2013 18:40
Install OpenCV from Git
version="4b203f7b1a0b1a731b98fc4e504d2bf7815a14a5"
echo "Downloading OpenCV from Git"
git clone https://github.com/Itseez/opencv.git
echo "Checking out commit " $version
git checkout $version
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libtiff4-dev libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils ffmpeg
echo "Building OpenCV from Git"
## Fish shell prompt for bash
## Make your bash shell's prompt look like Fish
##
## Changes color based on whether last command was succesful
## Shows shortened path names in prompt (like fish)
##
## .bashrc snippet by techwizrd
function _short_pwd {
_dir_abbr=$(temp=$(echo "${PWD/$HOME/~}" |sed -r 's/(\/.)[^/]*/\1/g'); echo ${temp:0:$(( ${#temp} - 1 ))})