Skip to content

Instantly share code, notes, and snippets.

View Swyter's full-sized avatar
💭
¯\_(ツ)_/¯

Swyter Swyter

💭
¯\_(ツ)_/¯
View GitHub Profile
@chowder
chowder / README.md
Last active May 23, 2026 03:05
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

@Swyter
Swyter / fixes.sh
Last active December 6, 2022 07:26
mab-warband-macos-binary-patches.txt
sh <<EOF && sh -c "# swy: zsh in catalina+ doesn't support inline comments: https://apple.stackexchange.com/a/405317"
# swy: needed for sed to stop complaining about the wholy unsupported hexadecimal literals
export LANG=C
export LC_ALL=C
# swy: go into the game's binary folder
cd ~/'Library/Application Support/Steam/steamapps/common/MountBlade Warband/Mount and Blade.app/Contents/MacOS'
# swy: turn their ../../.. hack into the harmless .//.//./ without changing the length of the string
sed -i '' 's|\.\./\.\./\.\.|\.//\.//\./|g' ./'Mount and Blade'
@Swyter
Swyter / listado-sds.md
Last active April 29, 2026 16:10
Listado de descargas de versiones antiguas de ContaSol, FactuSol, TPVSol y NominaSol de la compañia Software DELSOL
@shinyquagsire23
shinyquagsire23 / gist:824d4e6b08379f3b537fa703d2b1874a
Created October 26, 2022 01:46
Pixel Watch - Dump boot_a/boot_b from fastboot using sha1sum and ramdump memes
# Dump partitions from the Pixel Watch's fastboot using `oem sha1sum`
# and `oem ramdump` memes.
#
# Currently the first 8 bytes aren't bruteforced, but they ~can be.
# Doesn't really matter though because the first 8 bytes is the "ANDROID!" magic
# for boot partitions.
import os
import sys
import subprocess
import hashlib
@Swyter
Swyter / linux-vfio-kvm-passthrough-with-amd-card.md
Last active November 22, 2022 05:42
Linux VFIO KVM Passthrough with AMD Radeon card -- Solution for dmesg error «No more image in the PCI ROM» -- VFIO single graphics card bootup

If you have a black screen when trying to boot your guest OS via qemu/kvm with passthrough for your AMD Radeon card (in my case RX 480/590 or POLARIS10) and nothing is working, and you are able to ssh into the host while the virtualization is running or afterwards and get something like this via dmesg:

...
vfio_ecap_init: hiding ecap 0x19@0x270
...
vfio-pci 0000:03:00.0: No more image in the PCI ROM
...

Then the solution is to boot Linux through pure EFI; the problem is enabling CSM and then either booting the host system through a legacy BIOS bootloader or EFI. TL;DR: Disable CSM, ensure you've a proper EFI boot chain first. Then it will work straight away.

@JarkkoPFC
JarkkoPFC / bitonic_sort64.h
Last active December 3, 2024 22:23
Bitonic sort for 64 elements
template<typename T>
void bitonic_sort64(T vals_[64])
{
int h=-1;
do
{
for(unsigned i=0; i<32; ++i)
{
unsigned idx0=2*i;
unsigned idx1=4*(i&h)-2*(i+h)-1;
@Swyter
Swyter / pc-port-best-practices.md
Last active July 8, 2022 03:28
PC game port best practices
  • Always use scancodes for keyboard game input to make WASD work even under DVORAK or AZERTY layouts; you care about the key position, not the meaning.

    • Use keycodes to retrieve the actual key meaning/value when you need actual text input.
  • Support paths bigger than 256 characters (MAX_PATH), this should no longer be a limitation. Launch your game from a folder or symlink with hundreds of characters; this can be combined with the next point.

  • Try your game with a special username/user account that has international characters and spaces, like Ñame áôeÓ®他の詩っステム 元バ to ensure you are handling Unicode paths correctly. This is especially tricky on Windows, where you will have to wrap fopen() with the UTF-16 version because the normal version does not understand UTF-8.

    • Very often players with non-English names won't be able to save under AppData or their home directory otherwise.
  • On Windows you should store your savegames under the special %USERPROFILE%\Saved Games folder, use a dynamica

@zingaburga
zingaburga / sve2.md
Last active May 11, 2026 05:41
ARM’s Scalable Vector Extensions: A Critical Look at SVE2 For Integer Workloads

ARM’s Scalable Vector Extensions: A Critical Look at SVE2 For Integer Workloads

Scalable Vector Extensions (SVE) is ARM’s latest SIMD extension to their instruction set, which was announced back in 2016. A follow-up SVE2 extension was announced in 2019, designed to incorporate all functionality from ARM’s current primary SIMD extension, NEON (aka ASIMD).

Despite being announced 5 years ago, there is currently no generally available CPU which supports any form of SVE (which excludes the [Fugaku supercomputer](https://www.fujitsu.com/global/about/innovation/

@pervognsen
pervognsen / shift_dfa.md
Last active May 9, 2026 11:46
Shift-based DFAs

A traditional table-based DFA implementation looks like this:

uint8_t table[NUM_STATES][256]

uint8_t run(const uint8_t *start, const uint8_t *end, uint8_t state) {
    for (const uint8_t *s = start; s != end; s++)
        state = table[state][*s];
    return state;
}
@Swyter
Swyter / terraingen-rescued-lib-perlin.cpp
Last active April 26, 2021 19:54
cmpxchg8b's TerrainGen code; generates a scene mesh from their respective terrain code, just like Mount&Blade Warband does. Recovered from a corrupted disk, these aren't the original filenames.
#include "Perlin.h"
#include "Utils.h"
#include <cmath>
unsigned char g_perlinPermutationTable[256] =
{
198, 12, 146, 95, 44, 18, 240, 28, 151, 32, 45, 20, 30, 23, 141, 248,
168, 254, 178, 85, 92, 216, 236, 175, 47, 88, 67, 136, 234, 1, 72, 106,
79, 220, 24, 171, 26, 224, 128, 137, 223, 16, 105, 195, 231, 183, 29, 132,
241, 122, 252, 135, 5, 181, 130, 213, 49, 204, 70, 176, 144, 35, 64, 104,