Skip to content

Instantly share code, notes, and snippets.

View GeoffreyMetais's full-sized avatar

Geoffrey Métais GeoffreyMetais

View GitHub Profile
@GeoffreyMetais
GeoffreyMetais / glide pausing
Created February 14, 2017 08:04
RecyclerView.OnScrollListener for Glide
private class ChannelListScrollListener extends RecyclerView.OnScrollListener {
RequestManager glide = ((ListAdapter) mBinding.channelList.getAdapter()).getGlideRequestManager();
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_SETTLING)
glide.pauseRequests();
else
glide.resumeRequests();
}
}
@GeoffreyMetais
GeoffreyMetais / netlibre golang update script
Last active February 14, 2019 17:14
Update your IPv4 + IPv6 addresses only when they change. With several domains support.
package main
import (
b64 "encoding/base64"
"io/ioutil"
"net"
"net/http"
"strings"
)

Media states

  • resume position
  • audio track
  • subtitles track
  • audio delay (specific setting for BT headsets)
  • subtitles delay
  • start paused
  • Aspect ratio

Player states

@GeoffreyMetais
GeoffreyMetais / DiffUtilAdapter.kt
Created October 10, 2018 13:38
Example adapter implementation with DiffUtil
abstract class DiffUtilAdapter<D, VH : RecyclerView.ViewHolder> : RecyclerView.Adapter<VH>(), CoroutineScope {
override val coroutineContext = Dispatchers.Main.immediate
protected var dataset: List<D> = listOf()
private set
private val diffCallback by lazy(LazyThreadSafetyMode.NONE) { DiffCallback<D>() }
protected val detectMoves = true
private val updateActor = actor<List<D>>(capacity = Channel.CONFLATED) {
for (list in channel) internalUpdate(list)
}
dig -4 @resolver1.opendns.com ANY myip.opendns.com +short
curl -X PUT -H "Content-Type: application/json" \
-H "X-Api-Key: $APIKEY" \
-d '{"rrset_ttl": 10800,
"rrset_values": ["xx.xx.xx.xx"]}' \
https://dns.api.gandi.net/api/v5/domains/<domain.tld>/records/hal/A
curl -X PUT -H "Content-Type: application/json" \
-H "X-Api-Key: $APIKEY" \
#define EXTENSIONS_AUDIO \
"*.3ga;" \
"*.669;" \
"*.a52;" \
"*.aac;" \
"*.ac3;" \
"*.adt;" \
"*.adts;" \
"*.aif;"\
"*.aifc;"\