Skip to content

Instantly share code, notes, and snippets.

View aftabsikander's full-sized avatar

Aftab aftabsikander

  • Karachi,Pakistan
View GitHub Profile
@aftabsikander
aftabsikander / ProjectUtil.java
Last active June 14, 2018 11:27
Common Utilities
package com.app.example.util;
import android.Manifest;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
@aftabsikander
aftabsikander / proguard
Created January 11, 2018 13:46
Proguard Rule
-dontwarn com.google.android.gms.**
-dontwarn com.github.siyamed.shapeimageview.**
-keepattributes Signature
-keepattributes *Annotation*, EnclosingMethod
-dontwarn com.google.android.gms.**
-dontwarn android.support.**
-optimizationpasses 25
-dontusemixedcaseclassnames
-dontpreverify
@aftabsikander
aftabsikander / git.migrate
Created November 27, 2017 21:36 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@aftabsikander
aftabsikander / ImageCompression
Created August 22, 2017 23:19 — forked from vipulasri/ImageCompression
Whatsapp Like Image Compression
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.media.ExifInterface;
import android.os.AsyncTask;
import android.os.Environment;
@aftabsikander
aftabsikander / KeyboardUtil.java
Created August 10, 2017 14:56
This class implements a hack to change the layout padding on bottom if the keyboard is shown to allow long lists with editTextViews Basic idea for this solution found here: http://stackoverflow.com/a/9108219/325479
import android.app.Activity;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.inputmethod.InputMethodManager;
/**
* This class implements a hack to change the layout padding on bottom if the keyboard is shown
* to allow long lists with editTextViews
@aftabsikander
aftabsikander / KeyStoreHelper.java
Created June 30, 2017 08:09 — forked from alphamu/KeyStoreHelper.java
Using Android KeyStore to generate a password. The code create a public/private key pair and uses the base64 encoded form of the certificate to as the password. The code modified the KeystoreHelper class from AOSP demo projects.
/*
* Copyright 2013 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@aftabsikander
aftabsikander / PrefixedEditText.java
Created May 23, 2017 19:04 — forked from alexfu/PrefixedEditText.java
EditText with support for prefixes.
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.EditText;
/**
@aftabsikander
aftabsikander / ExtendedEditText.java
Created May 23, 2017 19:03 — forked from kennydude/ExtendedEditText.java
Ever wanted a prefix and suffix on your EditText? Yes, well this ExtendedEditText class will do it for you!
package me.kennydude.spending.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.*;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.text.Editable;
import android.text.TextPaint;
import android.text.TextWatcher;
@aftabsikander
aftabsikander / androidmanifest.xml
Created May 3, 2017 13:59 — forked from josh-burton/androidmanifest.xml
Prevent TouchWiz from surrounding your app icon in a frame
<!-- Prevents TouchWiz from surrounding your app icon in a frame -->
<!-- Add to your manifest inside the application tag -->
<meta-data
android:name="com.samsung.android.icon_container.has_icon_container"
android:value="true"/>
@aftabsikander
aftabsikander / generateClassifier.py
Last active April 20, 2017 20:48
Generate Classifier for Mnist handwritting digits
import struct
import os
from array import array as pyarray
from sklearn.externals import joblib
from numpy import *
from pylab import *
from sklearn import svm
DATASET_PATH='/media/afali/Project/Projects/Projects/Python-workspace/hello-scikitlearn/Dataset/'