Skip to content

Instantly share code, notes, and snippets.

View PaulCreusy's full-sized avatar

Paul Creusy PaulCreusy

View GitHub Profile
@PaulCreusy
PaulCreusy / plot_neural_interpretation_diagram.py
Created November 7, 2024 16:01
Neural Interpretation Diagram plot for Python and Tensorflow
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
def plot_neuron_level_nid(model):
"""
Plot a neuron-level Neural Interpretation Diagram (NID) for a TensorFlow model,
including biases.
Parameters:
@PaulCreusy
PaulCreusy / NFC_reader.py
Created October 22, 2024 20:09
NFC Reader Android application with Python and Kivy
__version__ = '1.0'
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.clock import Clock
# Android NFC-specific imports
from jnius import autoclass, cast
@PaulCreusy
PaulCreusy / AdaptiveIconsBuildozer.md
Last active July 30, 2024 13:04
How to create adaptive icons for Android application with Buildozer and Kivy

How to create adaptive icons for Android application with Buildozer and Kivy

This document aims to explain how to create adaptive icons for Android applications developed with Kivy and compiled with Buildozer.

Context 📖

The configuration file buildozer.spec allows you to specify an icon to use for your application by editing the following portion of the file :

# (str) Icon of the application
@PaulCreusy
PaulCreusy / Azure_MFA_and_recover_email.py
Created July 7, 2024 12:16
Python script to authenticate with MFA to Azure and recover the user's email.
import requests
from azure.identity import InteractiveBrowserCredential
# Define your Azure AD client ID
client_id = ...
# Define the Microsoft Graph API scope
scope = ["User.Read"]
# Create the InteractiveBrowserCredential instance

Instructions to create automatic sphinx documentation based on app modules and packages

Install required packages

Install the following packages.

sphinx==7.2.6
sphinx_rtd_theme==2.0.0
@PaulCreusy
PaulCreusy / azure_user_passwd_connection.py
Created June 15, 2024 08:56
Azure connection protocol for username and password
from azure.identity import UsernamePasswordCredential
credential = UsernamePasswordCredential(
client_id="client_id_found_in_azure",
username="email",
password="password",
)
print(credential.get_token("https://graph.microsoft.com/.default"))
def levenshtein(chaine1, chaine2):
n = len(chaine1)
m = len(chaine2)
d = [[0 for j in range(m + 1)] for i in range(n + 1)]
for i in range(0, n + 1):
d[i][0] = i
for j in range(0, m + 1):
d[0][j] = j
for i in range(0, n):
for j in range(0, m):
@PaulCreusy
PaulCreusy / scrollable_frame.py
Last active June 20, 2024 08:32
Scrollable Frame for tkinter
import os
import tkinter as tk
from tkinter import ttk
class ScrollableFrame(ttk.Frame):
def __init__(self, container, *args, **kwargs):
super().__init__(container, *args, **kwargs)
canvas = tk.Canvas(self, takefocus=0, highlightthickness=0)
self.canvas = canvas
scrollbar = ttk.Scrollbar(self, orient="vertical", command=canvas.yview)
@PaulCreusy
PaulCreusy / SelfSignWindowsExecutable.md
Last active April 4, 2025 19:53
How to self-sign a Windows executable created with Pyinstaller

How to self-sign a Windows package created with Pyinstaller

This document aims to explain all the necessary steps to self-sign a Windows executable.

⚠️ Warning
Some of the commands provided need to be completed. The fields to complete are indicated by the characters < and >.

Prerequisites

Please make sure to match all the prerequisite before starting the process of signing the package.

@Guhan-SenSam
Guhan-SenSam / instructions.md
Last active February 24, 2025 23:41
Creating an AAB for python apps using Buildozer

Introduction

Recently Google made it compulsory that all new apps must be uploaded not as .apk files but as .aab files. Till just recently the tool Buildozer was only able to compile your python applications to .apk but recent changes have allowed us to compile to .aab format. This is an instruction set that can be used to create a release .aab.

What is an AAB

The new .aab format may be a little confusing. .aab stands for app bundles and consists of a bundle of apk's within it. When you upload an aab to the playstore you are basically uploading a bunch of apk. PlayStore then based on the device that is downloading your application will generate the required apk based on that devices architecture and other parameters.

The introduction of .aab doesn't mean that .apk are no longer useful. .aab are only used for releases where as .apk are still used for testing your application and sharing it with others to directly install(not through the store).

> Note: Test your applications