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 / 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:

@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 / 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 / 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 / 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 / CustomFontLoader.java
Created June 5, 2018 06:27
A utility class to load custom font from the assets/font folder on Views
public class CustomFontLoader {
public static final int FONT_NAME_1 = 0;
public static final int FONT_NAME_2 = 1;
private static final int NUM_OF_CUSTOM_FONTS = 2;
private static boolean fontsLoaded = false;
private static Typeface[] fonts = new Typeface[2];
@pfieffer
pfieffer / Time12And24hrFormat.java
Created June 5, 2018 08:16
A function to convert 12 hr time in string format to 24 hr time in string format and vice versa
/**
*
* @param timeString A string value of time in 12 hr format
* @return A string value of time in 24 hr format
*/
private String getTimeIn24hrFormat(String timeString) {
DateFormat inFormat = new SimpleDateFormat( "hh:mm a");
/* This is a 24 hour date time format that we are using to convert all
* input date and time formats to this format.
*/
<!--from scratch coding, here. -->
<!DOCTYPE html>
<html>
<head>
<title>Password Salting</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstap-theme.css">
<!DOCTYPE html>
<html>
<head>
<title>Sign up form</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstap-theme.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-theme.min.css">
</head>
<?php
//For connecting the database
$link = mysqli_connect("localhost","root","", "practise");
if (!$link) {
echo "Error: Unable to connect to MySQL." . PHP_EOL;
echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
exit;
}