Skip to content

Instantly share code, notes, and snippets.

View mrenouf's full-sized avatar

Mark Renouf mrenouf

View GitHub Profile
@mrenouf
mrenouf / keybase.md
Created January 21, 2015 02:56
My Keybase proof

Keybase proof

I hereby claim:

  • I am mrenouf on github.
  • I am mrenouf (https://keybase.io/mrenouf) on keybase.
  • I have a public key whose fingerprint is 3A76 13EC 9AF1 79E5 0A84 E29F C42A 8652 1ACD 8184

To claim this, I am signing this object:

ViewRootImpl.deliverInputEvent
....
ViewRootImpl.processPointerEvent
View.dispatchPointerEvent (DecorView)
View.dispatchTouchEvent (DecorView)
Activity.dispatchTouchEvent (Window.Callback)
Window.superDispatchTouchEvent (PhoneWindow)
DecorView.superDispatchTouchEvent
super.dispatchTouchEvent(event) (ViewGroup)
@mrenouf
mrenouf / ViewGroups.java
Created February 9, 2018 19:18
ViewGroups
package com.example.mrenouf.touchtest;
import android.support.v4.view.ViewCompat;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@mrenouf
mrenouf / NonGreedyNestedScrollView.JAVA
Created February 9, 2018 19:19
NonGreedyNestedScrollView
package com.example.mrenouf.touchtest;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.widget.NestedScrollView;
import android.util.AttributeSet;
import android.view.MotionEvent;
public class NonGreedyNestedScrollView extends NestedScrollView {
package com.example.mrenouf.touchtest;
import android.graphics.Rect;
import android.support.v4.view.ViewCompat;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import java.util.ArrayList;
import java.util.List;
package com.example.mrenouf.touchtest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
<?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"
#!/usr/bin/env bash
#
# Enable port forwarding when using Private Internet Access
#
# Usage:
# ./port_forwarding.sh
error( )
{
echo "$@" 1>&2
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
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)