Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Nitin Khanna beNitinhere

🎯
Focusing
View GitHub Profile
View PreferenceManager.java
package in.blackpaper.benitinhere.data.prefs;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
public class PreferencesManager {
private final static String TAG = PreferencesManager.class.getSimpleName();
// private static PreferencesManager instance;
private static SharedPreferences pref;
@beNitinhere
beNitinhere / permissions.java
Created Jun 26, 2018
Android camera and gallery permissions
View permissions.java
private void selectImage() {
try {
PackageManager pm = getPackageManager();
int hasPerm = pm.checkPermission(Manifest.permission.CAMERA, getPackageName());
if (hasPerm == PackageManager.PERMISSION_GRANTED) {
final CharSequence[] options = {"Take Photo", "Choose From Gallery", "Cancel"};
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(context);
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.chooseimage_alertdialog_l, null);
@beNitinhere
beNitinhere / permissions.java
Created Jun 26, 2018
Android camera and gallery permissions
View permissions.java
private void selectImage() {
try {
PackageManager pm = getPackageManager();
int hasPerm = pm.checkPermission(Manifest.permission.CAMERA, getPackageName());
if (hasPerm == PackageManager.PERMISSION_GRANTED) {
final CharSequence[] options = {"Take Photo", "Choose From Gallery", "Cancel"};
android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(context);
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.chooseimage_alertdialog_l, null);
@beNitinhere
beNitinhere / Android dropdown
Created Jun 26, 2018
Android dropdown layout
View Android dropdown
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/alert_title"
android:layout_width="match_parent"
android:layout_height="0dp"
@beNitinhere
beNitinhere / Datacrawler.py
Created Apr 19, 2018
Data Crawler in python
View Datacrawler.py
import urllib2,sys
orig_stdout = sys.stdout
f = open('E:/Documents/sample.html', 'w')
sys.stdout = f
response=urllib2.urlopen("https://cracxpro.com/microsoft-office-2013-product-key-generator/")
source=response.read()
print source
@beNitinhere
beNitinhere / maven.txt
Created Apr 15, 2018
Work with Apache maven in visual studio code
View maven.txt
//Run the following command
mvn archetype:generate
// -DgroupId=..........
// -DartifactId=.........
// -DarchetypeArtifactId=maven-archetype-quickstart
// -DinteractiveMode=false
@beNitinhere
beNitinhere / launch.json
Created Apr 15, 2018
launch.json File for java
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Debug (Launch)-App<com.blackpaper.topdf>",
"request": "launch",
@beNitinhere
beNitinhere / Custom_bashrc.sh
Created Apr 14, 2018
Custom_bashrc.sh is a custom bashrc file for Ubuntu.
View Custom_bashrc.sh
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@beNitinhere
beNitinhere / Screenshots.java
Last active Apr 14, 2018
Automatic Screenshots capturing tool for android
View Screenshots.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
class Screenshots {
public static void main(String args[]) {
BufferedReader bufferedReader = null;
Scanner scanner=new Scanner(System.in);
@beNitinhere
beNitinhere / Screenshots.py
Created Apr 14, 2018
Screenshots.py is an python script for taking screenshots of android mobile using system and save these in system
View Screenshots.py
import os
def Screenshot(n):
pageno=1
for pageno in range(pageno,n):
print ("Wait...")
os.system("adb exec-out screencap -p > " +str(pageno)+".png")
os.system("adb shell input swipe 300 700 50 700")
Screenshot(8)
You can’t perform that action at this time.