Skip to content

Instantly share code, notes, and snippets.

View deepakpk009's full-sized avatar
๐Ÿ‘‹
Android & Roku Development

Deepak PK deepakpk009

๐Ÿ‘‹
Android & Roku Development
View GitHub Profile
@deepakpk009
deepakpk009 / add_git_submodule.txt
Created August 8, 2017 09:26
how to add a git android library project as a sub module, to a project
how to add a git android library project as a sub module, to a project
1. create an android project
2. add to vcs (vcs - import into version control - create git repository)
3. goto terminal and add sub-module - make sure the location folder name is different than the original project name
git submodule add https://[email protected]/YYY/ZZZ.git
4. goto file menu - project structure
5. click '+' on left top
6. select 'import gradle project'
@deepakpk009
deepakpk009 / remove_tag_git.txt
Last active August 8, 2017 09:30
Removing a tag from git
If you have created a tag called 'release01'
in a Git repository you would remove it from your repository
by doing the following:
$ git tag -d release01
$ git push origin :refs/tags/release01
to push every local tag to remote
git push origin --tags
@deepakpk009
deepakpk009 / RestClient.java
Created August 8, 2017 09:43
How to POST Form data with multiple attachments using Retrofit
public interface FormUploadService {
@Multipart
@POST("<post-url-endpoint>") // the post url endpoint
Observable < String > postFormWithAttachments(
@Header(AppConstants.KEY_AUTH) String authKey, // auth key, if required
@PartMap Map < String, RequestBody > params); // our form data map
}
public void postForm(String authKey,
@deepakpk009
deepakpk009 / wifi_ubuntu_help.txt
Created August 11, 2017 08:56
wifi not connecting problem in ubuntu
sometimes in ubuntu the wifi will not connect to the network,
it will continiously try to connect to a wifi network but will fail
continously. for this apply the following fix:
1. open terminal - > type in 'ifconfig' -> enter
it will list the available networks like this:
enp2s0 Link encap:Ethernet
lo Link encap:Local Loopback
wlp3s0 Link encap:Ethernet
@deepakpk009
deepakpk009 / batch_resize.txt
Created August 13, 2017 09:33
batch resize images in a folder
Use Imagemagick's batch tool, mogrify.
This takes most of the same arguments.
To scale the longest size down to 300px, we can offer -resize "300x300>".
For safety's sake I've also got this saving the new images into a subdirectory rather than overwriting.
# assuming you're in the directory of images
mkdir resized
mogrify -resize "300x300>" -path resized *.jpg
The ">" means that It will only resize if the image is bigger than the given size.
@deepakpk009
deepakpk009 / MainActivity.java
Created August 20, 2017 09:45 — forked from takeshiyako2/MainActivity.java
Android Sample Open Facebook Page
package facebook.page.test;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
@deepakpk009
deepakpk009 / amazon-ec2-ftp.md
Created September 3, 2017 07:12 — forked from gunjanpatel/amazon-ec2-ftp.md
amazon ec2 LAMP and FTP installation and setup
@deepakpk009
deepakpk009 / git-checkout-dependency-error.txt
Last active September 15, 2017 07:33
Error:Project :app declares a dependency from configuration 'compile' to configuration 'default'
Error:Project :app declares a dependency from configuration 'compile' to configuration 'default'
which is not declared in the descriptor for project :<project-name>.
this happens when you have submodules in your project,
to fix this clone using recursive git command:
git clone --recursive https://github.com/developer-id/project.git
now go to the submodule folder and check the git repo version by:
@deepakpk009
deepakpk009 / Connectivity.java
Created September 24, 2017 10:31 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],