Skip to content

Instantly share code, notes, and snippets.

Avatar
🏕️
Living

Antoine Vianey avianey

🏕️
Living
View GitHub Profile
@avianey
avianey / JobIntentServiceInternal.kt
Created Apr 9, 2021
JobIntentService crashing with java.lang.RuntimeException: An error occurred while executing doInBackground()
View JobIntentServiceInternal.kt
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 / BitSet.kt
Last active Apr 25, 2020
Kotlin extensions for java BitSet, with shift left, shit right and shift intersect
View BitSet.kt
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 Dec 6, 2019
Wifi driver for XPS-15 with i7-9XXX Ubuntu 18.04
View script.sh
# 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 / DisplayLink-DellXPS15-Ubuntu18.sh
Created Nov 22, 2019
Make displaylink D3100 Dell docking station work with Dell XPS15 running ubuntu 18.04
View DisplayLink-DellXPS15-Ubuntu18.sh
@avianey
avianey / Activity.java
Last active Nov 19, 2019
Add Tab with custom click handler along with ViewPager Android Material component
View Activity.java
TabLayout tabLayout = findViewById(R.id.tabs);
if (tabLayout != null) {
tabLayout.setupWithViewPager(
pager,
false // avoid listen for change of items in the adapter
);
try {
// Add custom tabs with managed click handler
Method m = tabLayout.getClass().getDeclaredMethod("createTabView", TabLayout.Tab.class);
m.setAccessible(true);
View Main.java
class SampleCode {
public static void main(String[] args) {
// TODO
}
}
View Revert version 321 of your app using apktool
java -jar apktool.jar d 321.apk
java -jar apktool.jar b 321 -o 323.apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./your.keystore 323.apk alias
[android-sdk]/build-tools/27.0.2/zipalign -v 4 323.apk 323-aligned.apk
View Curated JS Links
@avianey
avianey / PowerSet.java
Last active Apr 9, 2021
A blazing fast bitmask backed PowerSet java implementation that supports size range ;-)
View PowerSet.java
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;
@avianey
avianey / LibGDXCardDeck.java
Last active Oct 3, 2017
Generates LibGDX BitmapFont and TextureAtlas at build time with Gradle
View LibGDXCardDeck.java
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;