Skip to content

Instantly share code, notes, and snippets.

from itertools import permutations
from typing import Optional
def add(n1, n2):
return n1+n2
def sub(n1, n2):
return n1-n2
def mul(n1, n2):
@soxrok2212
soxrok2212 / UBI Remove OOB Data
Created August 24, 2022 04:51
UBI Remove OOB Data
#!/usr/bin/env python3
import sys
PAGE, OOB= 2048, 64
BLOCK = PAGE + OOB
orig_dump = open(sys.argv[1], 'rb').read()
out_dump = open(sys.argv[2], 'wb')
nblocks = int(len(orig_dump) / BLOCK)
for i in range(nblocks):
@masemoel
masemoel / BuildGuide.txt
Last active October 11, 2024 02:56
How to build an A12+ ROM from scratch under Ubuntu 22.04 (or based) and higher
To build a A12+ (AOSP/LOS based) on Ubuntu 22.04+ (or distros based on it), there are four main steps:
(This guide is applicable for recoveries as well (TWRP, OFRP...))
Working on Android 12 and upper
#################################################################
# Step 1: Setup your environment #
#################################################################
****Setup Linux to build Android****
@fiddyschmitt
fiddyschmitt / gist:4e49019c8f10b267fb7f3284689f88c4
Last active November 4, 2024 15:56
ffmpeg - send and receive G.711 RTP audio
--list input devices
ffmpeg -list_devices true -f dshow -i dummy
--to record microphone to mp3
ffmpeg -f dshow -i audio="Microphone (Logitech USB Headset H340)" -c:a libmp3lame -ar 44100 -b:a 320k -ac 1 output1.mp3
--send mic to rtp multicast g.711
ffmpeg -f dshow -i audio="Microphone (Logitech USB Headset H340)" -ac 1 -ar 8000 -ab 64 -acodec pcm_mulaw -f rtp rtp://239.0.0.1:5656
--play received audio
@edro15
edro15 / SynchNTPtoGPS.md
Created February 13, 2018 16:45
[How To] Synchronize NTP server to a GPS/PPS source

So, I want to have a GPS Receiver driving a PPS (pulse-per-second) signal to the NTP server for a highly accurate time reference service.

Introduction

There are at least a couple of ways to propagate the PPS signal to the ntpd (NTP daemon) service, plus some variants in each case. However, the GPS device must be seen as a device that sources two different types of data:

  • the absolute date and time, and
  • the 1Hz clock signal (PPS).

The first one provides the complete information (incl. date and time) about when now is, but with poor accuracy because data is sent over the serial port and then encoded using a specific protocol such as NMEA (National Marine Electronics Association). PPS provides instead a very accurate clock but without any reference to absolute time.

@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active November 17, 2024 04:56 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export to tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

@ankurk91
ankurk91 / github_gpg_key.md
Last active October 15, 2024 02:56
Signing git commits using GPG (Ubuntu/Mac)

Github : Signing commits using GPG (Ubuntu/Mac) 🔐

  • Do you have an Github account ? If not create one.
  • Install required tools
  • Latest Git Client
  • gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/