Skip to content

Instantly share code, notes, and snippets.

Work from home

Muh Isfhani Ghiath isfaaghyth

Work from home
View GitHub Profile
isfaaghyth /
Last active Jul 20, 2020
👾 Android Space

anything about android stuff!

get current activity

adb shell dumpsys window windows | grep -E 'mCurrentFocus'

start activity

adb shell am start -a android.intent.action.MAIN -n com.isfaaghyth.sample/.MainActivity

start activity with applink

adb shell am start -a android.intent.action.VIEW -d 'isfaaghyth://home'

View CacheManager.kt
internal class CacheManager(context: Context?) {
val preferences: SharedPreferences? by lazy(LazyThreadSafetyMode.NONE) {
inline fun <reified T> entry(key: String, obj: T) {
val objString = Gson().toJson(obj,
preferences?.edit()?.putString(key, objString)
View PopularMovieAdapter.kt
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView

Raw Query Factory:

interface GraphQuery {
    fun productSearch(): Extractor<String>


View EndlessRecyclerViewScrollListener.kt
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.StaggeredGridLayoutManager
abstract class EndlessRecyclerViewScrollListener : RecyclerView.OnScrollListener {
// The minimum amount of items to have below your current scroll position
// before loading more.
View ffmeg video square crop
fun ffmegCommand(cropSize: Int?, sourceFile: String, resultFile: String): Array<String> {
return arrayOf(
isfaaghyth / mysql.sql
Created Dec 20, 2018
InnoDB: Unable to lock ./ibdata1, error: 11
View mysql.sql
# cd /var/lib/mysql
# mkdir bak
# mv ibdata1 bak/.
# mv ib_logfile* bak/.
# cp -a bak/ibdata1 ibdata1
# cp -a bak/ib_logfile* .
# service mysql restart
public class HaversineFormula {
static double lat1, lat2, deg;
public HaversineFormula() {}
public static double calculate(double initialLat, double initialLong, double finalLat, double finalLong){
int R = 6371; // km
double dLat = toRadians(finalLat - initialLat);
public class CacheManager {
private static final String TAG = "CacheManager";
private static SharedPreferences getPref() {
return PreferenceManager.getDefaultSharedPreferences(RangerApplication.getContext());
public static void save(String key, String value) {
Log.d(TAG, "saveCache: " + value);
View mojave
Pre Mojave (from Sierra or High Sierra)
1. boot into recovery mode
2. take your logical volume ID
$ diskutil cs list
3. change CoreStorage logical volume into normal disk partition
# diskutil cs revert <<LOGICAL_VOLUME_ID>>
4. restart! and welcome to mojave installer.
Post Mojave
You can’t perform that action at this time.