Skip to content

Instantly share code, notes, and snippets.

View devstar0209's full-sized avatar

devstar0209

View GitHub Profile
import android.util.Log;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.RecyclerView;
public abstract class EndlessNestedScrollViewListener implements NestedScrollView.OnScrollChangeListener {
private boolean loading = true;
private int pageNumber = 0;
import android.util.Log;
import android.widget.Toast;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
/**
import android.content.Context;
import android.graphics.Color;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebResourceRequest;
@devstar0209
devstar0209 / HideSystemUI.kt
Last active March 4, 2024 02:19
hideSystemUi is a helper method called in onResume, which allows you to have a full-screen experience.
@SuppressLint("InlinedApi")
private fun hideSystemUi() {
WindowCompat.setDecorFitsSystemWindows(window, false)
WindowInsetsControllerCompat(window, viewBinding.videoView).let { controller ->
controller.hide(WindowInsetsCompat.Type.systemBars())
controller.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
}
}
// copy disk image of android device
// example adb command : adb shell su -c "dd if=/dev/block/bootdevice/by-name/system of=/sdcard/system.img"
// In this example, replace /dev/block/bootdevice/by-name/system with the specific partition or block you want to image,
// and /sdcard/system.img with the desired output file
// example adb command: adb pull /dev/block/mmcblk0 mmcblk0.img
String[] arrayCommand = {"sh", "-c","dumpsys telephony.registry | grep \"permission\""};
// in kotllin
val arrayCommand = arrayOf("su", "-c", "dumpsys", "telephony.registry", "|", "grep", "\"mCi=\"")
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 17+
//KOTLIN 1.7.20
//DEPS org.apache.commons:commons-text:1.9
//DEPS org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
@devstar0209
devstar0209 / NotificationTelegramBot.py
Last active March 4, 2024 02:17
Notify to me when a specific users makes a comment in a group in telegram
# pip install python-telegram-bot
from telegram.ext import Updater, MessageHandler, Filters
from telegram import ParseMode
import logging
# Set your Telegram bot token
TOKEN = 'your_bot_token'
# Set the user ID you want to monitor
@devstar0209
devstar0209 / PDFmodify.py
Last active March 6, 2024 03:27
python script that add a new line when semicolon is found in PDF text
# pip install PyPDF2
## version 2
import PyPDF2
def add_newline_on_semicolon(pdf_path):
# Open the PDF file in binary mode
with open(pdf_path, 'rb') as pdf_file:
# Create a PDF reader object
pdf_reader = PyPDF2.PdfFileReader(pdf_file)
@devstar0209
devstar0209 / ReadCSV.py
Last active March 4, 2024 02:17
Read CSV file in python
# Open the CSV file using csv lib
import csv
file = open('Salary_Data.csv')
csvreader = csv.reader(file)
header = []
header = next(csvreader)
header ## print header
rows = []
for row in csvreader:
rows.append(row)