Skip to content

Instantly share code, notes, and snippets.

Jim-Bar / ellipses.cpp
Last active March 9, 2023 22:07
Rainbow ellipses collision algorithm
* Copyright (C) 2021-2023 Jean-Marie BARAN (
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the “Software”), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
Jim-Bar /
Last active February 2, 2021 11:19
backuptool script generated by Open Gapps on a Google Pixel (1st gen)
# /system/system/addon.d/
. /tmp/backuptool.functions
if [ -z $backuptool_ab ]; then
Jim-Bar /
Last active February 1, 2024 08:46
OnePlus 6 - Stock Firmware
Jim-Bar /
Last active September 3, 2023 03:38
Huawei Mate 10 Pro - Stock Firmware

What is this?

This is a guide explaining how to unlock and flash a Huawei Mate 10 Pro (BLA-L09 in this guide) with a stock firmware, and how to retrieve a stock firmware from the Internet. I wrote it as a reminder to myself, but others could find it useful too.

IMPORTANT: The steps presented here can harm/brick your phone, and I cannot be held responsible for any damage you phone could suffer.

This guide assume that:

  • You don't mind losing all of your data
  • Your phone is not bricked (if it's the case there are ways of finding the required information for completing this guide − I cover some parts in this guide, but not everything)
  • You have either a Linux or Windows computer available
Jim-Bar /
Last active April 18, 2024 03:14
About YUV formats

About YUV formats

First of all: YUV pixel formats and Recommended 8-Bit YUV Formats for Video Rendering. Chromium's source code contains good documentation about those formats too: chromium/src/media/base/video_types.h and chromium/src/media/base/ (search for RequiresEvenSizeAllocation(), NumPlanes() and those kinds of functions).


You can think of an image as a superposition of several planes (or layers in a more natural language). YUV formats have three planes: Y, U, and V.

Y is the luma plane, and can be seen as the image as grayscale. U and V are reffered to as the chroma planes, which are basically the colours. All the YUV formats have these three planes, and differ by the different orderings of them.

Jim-Bar /
Last active July 26, 2017 07:39
PPCG: Count to 20 with Words! Word's prefixes and suffixes

Utility for the PPCG question [Count to 20 with Words!][countTo20WithWords].

To generate those outputs, just run: python

Of course you will need [wordListsByLength]. There are parameters that can be easily modified inside the script.

The scores are computed as follow:

  1. each prefix/suffix/contained word adds its length to the score.
  2. when all prefixes/suffixes/contained words are computed, add the number of prefixes/suffixes/contained words to the score.