Skip to content

Instantly share code, notes, and snippets.

private const val JOB_KEY = "androidx.lifecycle.ViewModelCoroutineScope.JOB_KEY"
/**
* [CoroutineScope] tied to this [ViewModel].
* This scope will be canceled when ViewModel will be cleared, i.e [ViewModel.onCleared] is called
*
* This scope is bound to [Dispatchers.Main]
*/
val ViewModel.viewModelScope: CoroutineScope
get() {
@bilsou
bilsou / CustomTabHelper.kt
Created December 18, 2024 17:55 — forked from Asutosh11/CustomTabHelper.kt
Android: Open a web page in chrome custom tabs and also show a custom native view on top of it
package com.asutosh.trials
import `in`.novopay.los.ui.offlinekyc.WebViewActivity
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.text.TextUtils
import android.widget.RemoteViews
@bilsou
bilsou / online_teaching_howto.md
Created September 1, 2024 08:08 — forked from tovrstra/online_teaching_howto.md
Share iPad/IPhone/Android screen in all sorts of ways...

Turn any Linux laptop into a wireless access point

When your institution's WiFi is flaky or overloaded by students voting on your polls, you can set up your own WiFi access point as follows on your Linux laptop for your tablet (in case your tablet does not support USB tethering, i.e. you're stuck with an iPad):

nmcli d wifi hotspot ifname <wifi_device> ssid <YOURSSID> band a password <your_pass>
@bilsou
bilsou / jinstall
Created January 29, 2022 12:28 — forked from matteyeux/jinstall
Script to install or update some tools made by J Levin
#!/bin/bash
#######################################################################
#
# Project......: jinstall
# Creator......: matteyeux
# Description..: Script to install or update some tools made by J Levin
# (Too lazy to download and extract myself)
# Type.........: Public
#
######################################################################
@bilsou
bilsou / Fastboot_cmd.txt
Created January 19, 2021 18:42 — forked from michaeljymsgutierrez/Fastboot_cmd.txt
Fastboot command lines for android
1. Flashing the recovery image:
fastboot flash recovery recovery.img
2. Flash the kernel and bootloader:
fastboot flash boot boot.img
3. Erase a partition:
fastboot erase cache
{
"$jason": {
"head": {
"title": "map",
"styles": {
"padded": {
"padding": "20",
"font": "HelveticaNeue-Bold",
"size": "20"
}
@bilsou
bilsou / AndroidWirelessDebug.md
Last active December 13, 2017 14:33
How to Debug Your Android App over WiFi

You need to connect your device to your computer via USB cable. Make sure USB debugging is working. You can check if it shows up when running adb devices.

  • Plug your phone(s) via usb

  • Enable usb debugging

  • Run adb devices and retrieve your phone(s)' DEVICE_ID

  • Run adb -s DEVICE_ID tcpip 5555