Skip to content

Instantly share code, notes, and snippets.

View mirjalal's full-sized avatar
👨‍💻
Composing

Mirjalal mirjalal

👨‍💻
Composing
View GitHub Profile
#!/usr/bin/env python
from sys import argv, exit, stdout
from time import sleep, time
from os import system
from subprocess import check_output, CalledProcessError
from threading import Thread, Event
from functools import partial
class StoppableThread(Thread):
@mirjalal
mirjalal / disable_realtime_protection.reg
Created December 15, 2020 09:16
save the code below to disable_realtime_protection.reg and run to disable windows defender completely!
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender]
"DisableAntiSpyware"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection]
"DisableBehaviorMonitoring"=dword:00000001
"DisableOnAccessProtection"=dword:00000001
"DisableScanOnRealtimeEnable"=dword:00000001
@mirjalal
mirjalal / android-wait-for-emulator
Created January 8, 2020 08:48
The copy of the original one (never will be deleted!)
#!/bin/bash
# Originally written by Ralf Kistner <[email protected]>, but placed in the public domain
set +e
bootanim=""
failcounter=0
timeout_in_sec=360
@mirjalal
mirjalal / The Math of ML.html
Created July 24, 2019 08:35
The Mathematics of Machine Learning by UC Berkeley. Written by Garret Thomas. Confuse to learn Math for Machine Learning, UC Berkeley give very good guidelines about math you need to learn.
<a href="https://media.licdn.com/dms/image/C511FAQHSxF6jLy6d5g/feedshare-document-images_800/1?e=1564041600&amp;v=beta&amp;t=oW9zc4qHy_n_6MmFHoL8sSJwisiPjQDHZVT8odnrmHU">Page 1</a>
<a href="https://media.licdn.com/dms/image/C511FAQHSxF6jLy6d5g/feedshare-document-images_800/2?e=1564041600&amp;v=beta&amp;t=lFF_CS1FBZQh2NAQp5qeZoENbhdfZPjetLVukd2pB0A">Page 2</a>
<a href="https://media.licdn.com/dms/image/C511FAQHSxF6jLy6d5g/feedshare-document-images_800/3?e=1564041600&amp;v=beta&amp;t=R8BzvUX5ngwb3D4f3LBAMLDkQEqsbKYG0-JLiCHYx_I">Page 3</a>
<a href="https://media.licdn.com/dms/image/C511FAQHSxF6jLy6d5g/feedshare-document-images_800/4?e=1564041600&amp;v=beta&amp;t=QK6oT05ZmXBhVAMTfbgrajSC-oYUU_dADgbH3jYBFzM">Page 4</a>
<a href="https://media.licdn.com/dms/image/C511FAQHSxF6jLy6d5g/feedshare-document-images_800/5?e=1564041600&amp;v=beta&amp;t=S7sN6E-Us7LvtYprczVxAxldQ6OfNN2nec7Rj5MCUlk">Page 5</a>
<a href="https://media.licdn.com/dms/image/C511FAQHSxF6jLy6d5g/feedshare-document-images_800/6?e=1564041600&amp;v=beta&
@mirjalal
mirjalal / getFilePath.kt
Created July 4, 2019 11:55
Get path of the files which picked from internal/external storage, Google Drive and Google Photos
/**
* Get full file path from external storage
*
* @param pathData The storage type and the relative path
*/
private fun getPathFromExtSD(pathData: Array<String>): String {
val type = pathData[0]
val relativePath = "/" + pathData[1]
var fullPath: String
@mirjalal
mirjalal / multifilepicker.kt
Last active June 28, 2019 12:20 — forked from kingargyle/multifilepicker.java
Android 4.4+ Select Multiple Files with UI File Picker
val intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
startActivityForResult(intent, 1)
// In code that handles the result returned to process the files:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
@mirjalal
mirjalal / Activity Lifecycle States and Callbacks Summary.txt
Created June 4, 2019 07:39
Activity Lifecycle States and Callbacks Summary
General Definitions
Visible Lifecycle: The part of the Lifecycle between onStart and onStop when the Activity is visible.
Focus: An Activity is said to have focus when it's the activity the user can interact with.
Foreground: When the activity is on screen.
Background: When the activity is fully off screen, it is considered in the background.
Lifecycle States
@mirjalal
mirjalal / find_missing_translations.py
Created May 30, 2019 13:12 — forked from kmansoft/find_missing_translations.py
A simple script to find missing translations in an Android project
#!/usr/bin/python
'''
This script finds missing string translations in Android applicaitons.
Author: Kostya Vasilyev. License: Creative Commons Attribution.
The output format is, I believe, more suitable to working with external
translators than the output of Lint from the Android SDK.
@mirjalal
mirjalal / OkHttpProgressGlideModule.java
Created June 28, 2017 08:05 — forked from TWiStErRob/OkHttpProgressGlideModule.java
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}
http://alvinalexander.com/java/jwarehouse/apps-for-android/RingsExtended/src/com/example/android/rings_extended/