Skip to content

Instantly share code, notes, and snippets.

@Abdallah-Abdelazim
Abdallah-Abdelazim / multiple_ssh_setting.md
Created February 18, 2023 23:56 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@Abdallah-Abdelazim
Abdallah-Abdelazim / UiText.kt
Last active September 3, 2023 13:03
UiText: use Android's String Resources in the whole project.
package com.example.app
import android.content.Context
import androidx.annotation.StringRes
sealed class UiText {
data class DynamicString(val value: String) : UiText()
data class StringResource(
@Abdallah-Abdelazim
Abdallah-Abdelazim / linux_start_app_minimized_script.md
Last active March 10, 2022 22:04
Linux Bash script to start an application minimized (useful for autostart minimized on login)

To start an application minimized (like the Todoist snap as in below), create a script similar to the following.
You can add the script to autostart on login in your DE.

#!/bin/bash
# Launch Todoist as a background process
/var/lib/snapd/desktop/applications/todoist_todoist.desktop&
# Loop, waiting for the window to initialise
i=0
while [ $i -lt 20 ]
@Abdallah-Abdelazim
Abdallah-Abdelazim / AutoClearedValue.kt
Created February 12, 2022 22:11
AutoClearedValue: A lazy property that gets cleaned up when the fragment's view is destroyed.
/*
* Copyright (C) 2018 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
@Abdallah-Abdelazim
Abdallah-Abdelazim / HttpsEverywhereInterceptor.java
Last active May 9, 2021 13:44
HttpsEverywhereInterceptor: An OkHttp interceptor to replace any HTTP scheme with HTTPS for outgoing network requests.
package com.example.network;
import androidx.annotation.NonNull;
import java.io.IOException;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
@Abdallah-Abdelazim
Abdallah-Abdelazim / InputValidationUtils.java
Last active March 12, 2021 00:42
Various utility functions to validate user input.
package com.example.util;
import android.text.TextUtils;
import android.util.Patterns;
import androidx.annotation.NonNull;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Abdallah-Abdelazim
Abdallah-Abdelazim / RoundedFrameLayout.java
Created January 11, 2021 20:30
A custom FrameLayout that allows you to round & clip the corners of this layout, and its children, with radii that you specify either in XML or with code.
package com.example;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.FrameLayout;
@Abdallah-Abdelazim
Abdallah-Abdelazim / drawablegen.sh
Last active November 30, 2023 22:16 — forked from Kishanjvaghela/converter.sh
drawablegen - A shell script to resize icon images and generate the alternative drawables with the proper screen pixel densities (dip) for Android.
#!/bin/sh
# A shell script to resize icon images and generate the alternative drawables with the proper screen pixel densities (dip) for Android.
# The passed icon image would be the xxxhdpi drawable & the other drawables (xxhdpi, xhdpi, hdpi & mdpi) would be scaled down from that.
# How to use:
# ./drawablegen.sh <icon image file relative path>
# Example:
# ./drawablegen.sh my_image.png
# This will create all the drawable folders, if not has already, in a res folder inside the current directory (as returned by pwd).
# Use only with PNG images.
# Requires ImageMagick to be installed & added to the path environment variable. Install with: sudo apt install imagemagick
@Abdallah-Abdelazim
Abdallah-Abdelazim / _fix_alt_shift_layout_switching_kde.md
Last active May 5, 2023 21:49
Fix: Alt+Shift layout switching not working in Arabic keyboard layout on KDE neon/Kubuntu
@Abdallah-Abdelazim
Abdallah-Abdelazim / BaseDao.java
Created March 31, 2020 01:44
A BaseDao interface that provides the methods needed for inserting, updating & deleting an entity in a Room Dao interface.
package com.example.app.data.local.dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Update;
import java.util.List;
/**