This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.flow.receiveAsFlow | |
import kotlinx.coroutines.flow.collect | |
import kotlinx.coroutines.flow.collectLatest | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.GlobalScope | |
import kotlinx.coroutines.delay | |
fun main() { | |
GlobalScope.launch { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.flow.receiveAsFlow | |
import kotlinx.coroutines.flow.collect | |
import kotlinx.coroutines.launch | |
import kotlinx.coroutines.GlobalScope | |
fun main() { | |
GlobalScope.launch { | |
val channel = Channel<String>(Channel.BUFFERED) // Replace it with RENDEZVOUS and behaviour will change, you won't see ABC printed | |
channel.send("ABC") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
clear | |
for f in {1..7} | |
do | |
vcgencmd measure_temp | |
sysbench --test=cpu --cpu-max-prime=20000 --num-threads=4 run >/dev/null 2>&1 | |
done | |
vcgencmd measure_temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DownloadWorker : Worker() { | |
/** | |
* This function will be called whenever the work manager run the work. | |
*/ | |
override fun doWork(): WorkerResult { | |
//Do some work | |
Thread.sleep(5000) | |
// Indicate success or failure with your return value. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.kevalpatel2106; | |
import android.os.AsyncTask; | |
import android.os.Bundle; | |
import android.support.annotation.Nullable; | |
import android.support.v7.app.AppCompatActivity; | |
import android.widget.TextView; | |
/** | |
* Created by Keval on 06/05/18. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add the view to the phone's window. | |
*/ | |
private void addToWindow() { | |
//Add the view to the window. | |
final WindowManager.LayoutParams params = new WindowManager.LayoutParams( | |
WindowManager.LayoutParams.WRAP_CONTENT, | |
WindowManager.LayoutParams.WRAP_CONTENT, | |
WindowManager.LayoutParams.TYPE_PHONE, | |
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OUTPUT: | |
# speech recognization | |
# Hello earnest... | |
# Say something! | |
# Got it! Now to recognize it... | |
# You said hello | |
# Install speech recognisation | |
sudo pip install SpeechRecognition |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Amazon music: | |
intentFilter.addAction("com.amazon.mp3.playstatechanged"); | |
intentFilter.addAction("com.amazon.mp3.metachanged"); | |
Spotify: | |
intentFilter.addAction("com.spotify.music.playbackstatechanged"); | |
intentFilter.addAction("com.spotify.music.metadatachanged"); | |
Samsung Music: | |
intentFilter.addAction("com.samsung.sec.android.MusicPlayer.metachanged"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Enter the access key. Tou can generate access key from \"https://github.com/settings/tokens\".:" | |
read ACCESS_TOKEN | |
echo "Enter to host url of the GitHub: (e.g. github.com)" | |
read GITHUB_INSTANCE | |
echo "Enter to the page number: (Script will download 100 repos per page.)" | |
read PAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- Put this file in the "debug" folder so it only gets merged into debug builds --> | |
<manifest | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
package="org.bookdash.android"> | |
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> | |
<uses-permission android:name="android.permission.WAKE_LOCK"/> | |
<!-- Disable animations on debug builds so that the animations do not interfere with Espresso |
NewerOlder