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
private const val FILE_TYPES = "?pc?d?b?-?l?s???" | |
fun String.toPosixModeInt(): Int { | |
require(length == 10) { "Should have 10 characters" } | |
// type | |
val type = when(get(0)) { | |
'p' -> 1 | |
'c' -> 2 | |
'd' -> 4 | |
'b' -> 6 |
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 adb | |
import kotlinx.coroutines.CoroutineName | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.DelicateCoroutinesApi | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.isActive | |
import kotlinx.coroutines.launch | |
import java.lang.ref.Reference | |
import java.lang.ref.ReferenceQueue |
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 adb.io | |
import adb.WeakReferenceMap | |
import java.lang.ref.Cleaner | |
import java.nio.ByteBuffer | |
import java.util.* | |
class ByteBufferSlicePool2( | |
capacity: Int, | |
) : ByteBufferAllocator { |
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 adb.io | |
import adb.io.ByteBufferSlicePool.Region.Alloc | |
import adb.io.ByteBufferSlicePool.Region.Free | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.MainScope | |
import kotlinx.coroutines.isActive | |
import kotlinx.coroutines.launch | |
import java.lang.ref.ReferenceQueue | |
import java.lang.ref.WeakReference |
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 adb.io | |
import adb.io.ByteBufferSlicePool.Region.Alloc | |
import adb.io.ByteBufferSlicePool.Region.Free | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.MainScope | |
import kotlinx.coroutines.isActive | |
import kotlinx.coroutines.launch | |
import java.lang.ref.ReferenceQueue | |
import java.lang.ref.WeakReference |
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 java.net.SocketAddress | |
import java.nio.ByteBuffer | |
import java.nio.channels.AsynchronousByteChannel | |
import java.nio.channels.AsynchronousSocketChannel | |
import java.nio.channels.CompletionHandler | |
import kotlin.coroutines.Continuation | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.resumeWithException | |
import kotlinx.coroutines.suspendCancellableCoroutine |
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
suspend fun AsynchronousByteChannel.readInto(buffer: ByteBuffer): Int = suspendCancellableCoroutine { | |
read(buffer, null, object : CompletionHandler<Int, Any?> { | |
override fun completed(result: Int, attachment: Any?) { it.resume(result) } | |
override fun failed(exc: Throwable, attachment: Any?) = it.resumeWithException(exc) | |
}) | |
} | |
suspend fun AsynchronousByteChannel.writeFrom(buffer: ByteBuffer): Int = suspendCancellableCoroutine { | |
write(buffer, null, object : CompletionHandler<Int, Any?> { | |
override fun completed(result: Int, attachment: Any?) = it.resume(result) |
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
sudo apt install build-essential autoconf bison flex texinfo \ | |
help2man gawk libtool libncurses5-dev python3-dev \ | |
python3-distutils git | |
git clone http://github.com/crosstool-ng/crosstool-ng | |
cd crosstool-ng | |
./bootstrap | |
./configure --enable-local | |
DEFCONFIG=samples/armv8-rpi3-linux-gnueabihf/crosstool.config ./ct-ng defconfig |
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
#!/usr/bin/env bash | |
# | |
# Enable port forwarding when using Private Internet Access | |
# | |
# Usage: | |
# ./port_forwarding.sh | |
error( ) | |
{ | |
echo "$@" 1>&2 |
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"?> | |
<android.support.constraint.ConstraintLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@android:color/black"> | |
<android.support.constraint.Guideline | |
android:id="@+id/guideline_h50" |
NewerOlder