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 / convert-mp.sh
Last active January 25, 2025 17:26
Saving data from Google Photo by converting MP.jpg file to .jpg file, resizing images and converting old videos. Navigate Google Photo to download an extract of overweighted photos and then run the script below to remove the clip from the MP.jpg files. The script does takes care of keeping metadatas (GPS, date, camera info, ...) but saves a lot …
#!/bin/bash
# Set locale to ensure decimal point is handled correctly
export LC_NUMERIC="en_US.UTF-8"
# Check if the required tools are installed
if ! command -v ffmpeg &> /dev/null; then
echo "Error: ffmpeg is not installed. Please install ffmpeg and try again (sudo apt-get install ffmpeg)."
exit 1
fi
@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 / 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 / DisplayLink-DellXPS15-Ubuntu18.sh
Created November 22, 2019 09:41
Make displaylink D3100 Dell docking station work with Dell XPS15 running ubuntu 18.04
@avianey
avianey / Activity.java
Last active November 19, 2019 14:35
Add Tab with custom click handler along with ViewPager Android Material component
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);
class SampleCode {
public static void main(String[] args) {
// TODO
}
}
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
@avianey
avianey / Curated JS Links
Created January 19, 2017 08:09
Curated JS Links
@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;