Skip to content

Instantly share code, notes, and snippets.

View pfieffer's full-sized avatar
🦉
Working :/

Ravi Garbuja Pun pfieffer

🦉
Working :/
View GitHub Profile
@pfieffer
pfieffer / ImageUtil.java
Last active June 5, 2018 06:26
A utility class to convert Bitmap image to Base64 and vice versa.
public class ImageUtil {
/**
*
* @param base64Str Base64 string for the image.
* @return Bitmap value for the image.
* @throws IllegalArgumentException
*/
public static Bitmap convert(String base64Str) throws IllegalArgumentException {
byte[] decodedBytes = Base64.decode(
base64Str.substring(base64Str.indexOf(",") + 1),
@pfieffer
pfieffer / BitmapUtils.java
Last active November 21, 2021 17:06
A Bitmap utility class to resample the image, create temporary file image file, delete the image file, add picture to the gallery, save image to storage and share the image.
class BitmapUtils {
private static final String FILE_PROVIDER_AUTHORITY = "np.com.ravigarbuja.emojifyme.fileprovider";
/**
* Resamples the captured photo to fit the screen for better memory usage.
*
* @param context The application context.
* @param imagePath The path of the photo to be resampled.
@pfieffer
pfieffer / DpPixelConversion.java
Last active June 5, 2018 06:22
A utility class to convert DP(Desnsity independent Pixel to Pixel and vice versa)
public class DpPixelConversion {
public static int dpToPx(Context context, float dp) {
return (int) (dp * ((float) context.getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT));
}
public static float pxToDp(Context context, float px) {
return px / ((float) context.getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT);
}
}
@pfieffer
pfieffer / git-ssh-configuration.md
Created November 25, 2017 17:35 — forked from cham11ng/git-ssh-configuration.md
Configuring SSH for Git

Git Installation and SSH Configuration

By: Sagar Chamling

Installation

For Linux (Debian/Ubuntu):

sudo apt install git
@pfieffer
pfieffer / Obtain_SHA_Fingerprint.md
Last active September 7, 2022 10:05
Get key Hash for android app integration to Services like google and facebook login

To sign your apk:

https://developer.android.com/studio/publish/app-signing.html
Build and sign your app from terminal: keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-alias

Facebook:

To get debug key certificate:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

To get release key certificate: