Skip to content

Instantly share code, notes, and snippets.

View u1735067's full-sized avatar

Alexandre L. u1735067

View GitHub Profile
@u1735067
u1735067 / gptbin_reader.py
Last active February 9, 2023 16:23
Python gpt.bin decoder (gpt.bin for Xiaomi MiPad2, but probably for other plateforms too) ; you'll want https://gist.github.com/u1735067/b3a23c9461e95433387f285f6e0860ca
#!python3
''' BSD 3-Clause License — but if it was useful to you, you may tell me :)
Copyright (c) 2016-2017, Alexandre Levavasseur
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
@u1735067
u1735067 / configuration.cfg.example
Created January 31, 2023 14:58
An adaptation (NOT cleaned) of https://github.com/mattstruble/portainer-swarm-migrate using new StackAssociate API, for when you have to recreate your cluster because you locked yourself out :) // Consider same license as original code (MIT).
[portainer]
username=USER
password=PASSWORD
url=http://127.0.0.1:9000
[swarm]
clusterID=ID
# as seen in `docker info`
@u1735067
u1735067 / dns-320lw_uart.log
Created May 28, 2017 14:35
DNS-320LW Rev. A1 firmware v1.09b06 -- trying to debug the "can't boot unless has been in the fridge" temperature / thermal sensor issue -- I now know it's due to the Weltrend WT69P3 chip ; next step : try to UART connect this shit.
** MARVELL BOARD: DB-88F6702A-BP LE
U-Boot 1.1.4 (Mar 12 2012 - 16:23:48) Marvell version: 3.6.0.DNS-320L.01
U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CFB00
Soc: 88F6702 A1 CPU running @ 1000Mhz L2 running @ 500Mhz
SysClock = 400Mhz , TClock = 166Mhz
DRAM (DDR2) CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
@u1735067
u1735067 / guids.py
Last active November 15, 2022 03:22
GPT GUID List (manually constructed from different sources)
#!python3
from uuid import UUID
from datetime import date
# https://github.com/d-fence/frit/blob/master/frit/fritutils/fsprobe.py
# https://gist.github.com/sque/dc7a057e66371717e921
# https://en.wikipedia.org/wiki/GUID_Partition_Table
# https://github.com/n0fate/raw/blob/master/gpt_parser.py
# https://sourceforge.net/u/guikcd93/gptfdisk/ci/master/tree/parttypes.cc#l179
@u1735067
u1735067 / flipper_fap_manifest_sdk_api_patcher.py
Last active October 22, 2022 02:27
Simple patcher for Flipper Zero FAPs to change the target SDK API in the manifest ; it doesn't mean the patched app will work correctly (!), it only allow it to be loaded
import re, pathlib
target_version_major = 2
target_version_minor = 0
"""md
* https://github.com/flipperdevices/flipperzero-firmware/blob/0.69.1/lib/flipper_application/flipper_application.c#L45
* https://github.com/flipperdevices/flipperzero-firmware/blob/0.69.1/lib/flipper_application/flipper_application.c#L116
* https://github.com/flipperdevices/flipperzero-firmware/blob/0.69.1/lib/flipper_application/application_manifest.c#L12
* https://github.com/flipperdevices/flipperzero-firmware/blob/0.69.1/lib/flipper_application/application_manifest.h#L15
@u1735067
u1735067 / asgi.py
Created September 20, 2022 15:35
Django ASGI Locale middleware `LocaleAsgiMiddleware` (not well-tested)
"""
ASGI config for MyApp project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
"""
import os
@u1735067
u1735067 / sus_posix_infos.txt
Created March 4, 2018 17:42
Notes about POSIX & Single Unix Specification
Infos
https://en.wikipedia.org/wiki/Single_UNIX_Specification
https://github.com/geoff-codes/posix-unix-standard
https://mywiki.wooledge.org/POSIX
Single Unix Specification, SUS (T101) = "Base Specifications" POSIX-2008 (C165) (+ X/Open Curses (C094)) (??)
http://www.cse.psu.edu/~deh25/cmpsc311/Lectures/Standards/PosixStandard.html
"SUS"
https://publications.opengroup.org/t101
http://pubs.opengroup.org/onlinepubs/9699919799/
@u1735067
u1735067 / filter_plugins__as_unsafe.py
Created June 1, 2022 15:37
Simple filter to mark an Ansible variable as unsafe (untested)
#!/usr/bin/env python
"""Simple filter to mark a variable as unsafe"""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.utils.unsafe_proxy import wrap_var
def as_unsafe(var):
@u1735067
u1735067 / kdbx.ksy.yml
Last active January 23, 2022 15:59
KeePass kdbx kaitai format
meta:
id: kdbx
file-extension: kdbx
endian: le
license: ISC # https://spdx.org/licenses/ISC.html
doc: |
composite_key = sha256(sha256(password) + composites)
aes = new AES(128, CBC, iv=0x0 *16, key TRANSFORMSEED
transformed_key=sha256(for i in TRANSFORMROUNDS: aes.encrypt(transformed_key)))
---
# ---Setup:
# > ansible-playbook -i mytest.ini mytest.yml --limit test2
# ./mytest.ini:
# test1 site=ams
# test2 site=ams
# test3 site=blg
#
# ---Result:
# PLAY [TEST] ********************************************************************