Skip to content

Instantly share code, notes, and snippets.

@chowder
chowder / README.md
Last active March 12, 2025 17:54
Exporting Microsoft Authenticator TOTP secrets

Background

Workplaces may enforce TOTP 2FA to be enabled Office 365 accounts, which require the Microsoft Authenticator app to be installed.

Regular TOTP applications (such as Aegis, Authy, or LastPass) cannot be used as Microsoft uses a proprietary scheme called phonefactor. Furthermore, the application requires Google Services Framework (GSF) to be installed (likely to provide device notifications), and will refuse to work when it is not present on the device.

Forunately, after the registration is complete, the underlying mechanism the app uses to generate TOTP codes is regular otpauth, and its secrets can be exported with a little bit of effort.

Extracting the keys

@waltervargas
waltervargas / typeGenericMacrosC.md
Created May 13, 2021 13:10
Type Generic Macros in C

Type Generic Macros in C

source

#define sin(X) _Generic((X), \
   float: sinf, \
   double: sin, \
   long double: sinl \
)(X)
@pgolding
pgolding / remove_adobe_crud.py
Last active January 13, 2025 10:32
Using BeautifulSoup to remove Adobe entity tags (and width/height attributes) from SVG
'''
When rendering SVG files exported from Adobe Illustrator using Phantom JS,
the injected Adobe ENTITY tags can intefere with the render. This removes
the tags and also removes width/height attributes from the SVG tag.
'''
SVG_FILE = 'Some-adobe-illustrator-export.svg'
# By default, BeautifulSoup will ignore the <!ENTITY> array when parsing the file