Skip to content

Instantly share code, notes, and snippets.

View avianey's full-sized avatar
🏕️
Living

Antoine Vianey avianey

🏕️
Living
View GitHub Profile
@avianey
avianey / BitSet.kt
Last active April 25, 2020 17:59
Kotlin extensions for java BitSet, with shift left, shit right and shift intersect
infix fun shr(n: Int) {
require(n >= 0) { "'n' must be >= 0" }
if (n == 0 || words.isEmpty()) { return }
val step = n / 64
val shift = n % 64
if (shift == 0 && step == 0) { return }
for (i in words.indices) {
words[i] = when {
i < words.size - 1 - step -> {
@avianey
avianey / script.sh
Created December 6, 2019 19:38
Wifi driver for XPS-15 with i7-9XXX Ubuntu 18.04
# https://askubuntu.com/questions/1156167/unable-to-get-wifi-adapter-working-clean-19-04-install-network-unclaimed
sudo apt update
sudo apt install git build-essential
git clone https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi.git
cd backport-iwlwifi/
make defconfig-iwlwifi-public
sed -i 's/CPTCFG_IWLMVM_VENDOR_CMDS=y/# CPTCFG_IWLMVM_VENDOR_CMDS is not set/' .config
make -j4
sudo make install
sudo modprobe iwlwifi
@avianey
avianey / JobIntentServiceInternal.kt
Created April 9, 2021 17:50
JobIntentService crashing with java.lang.RuntimeException: An error occurred while executing doInBackground()
package androidx.core.app
abstract class JobIntentServiceInternal: JobIntentService() {
/**
* Returns a GenericWorkItem that will fail silently to complete
* if it has been cancelled while executing inside
* the JobIntentService$CommandProcessor#doInBackground loop
* or if dequeue fails
*/
@avianey
avianey / PowerSet.java
Last active April 9, 2021 17:52
A blazing fast bitmask backed PowerSet java implementation that supports size range ;-)
package fr.pixelprose.count.generator;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import static com.google.common.base.Preconditions.checkArgument;
import static java.lang.Math.min;