Skip to content

Instantly share code, notes, and snippets.

View leonhard-s's full-sized avatar

Leonhard S. leonhard-s

  • Zürich, Switzerland
View GitHub Profile
@leonhard-s
leonhard-s / ps2-zone-checker.py
Created April 5, 2022 19:35
A Python script for checking which continents are currently open in PlanetSide 2.
import asyncio
from typing import Any, Dict, Iterator, List, Optional, Tuple, cast
import auraxium
# A mapping of zone IDs to the region IDs of their warpgates
_WARPGATE_IDS: Dict[int, List[int]] = {
# Indar
2: [
2201, # Northern Warpgate
@leonhard-s
leonhard-s / cmbl-to-xlsx.py
Created March 27, 2021 20:22
A conversion script to turn text mode Logger Pro CMBL files into Excel spreadsheets.
"""A script for loading Logger Pro *.cmbl files into an Excel workbook.
Every matching file will be loaded into a separate Excel worksheet.
Note that this converter only works with text-based cmbl files, binary
files are not supported.
"""
import argparse
import array
@leonhard-s
leonhard-s / build-grammar.py
Created October 27, 2020 19:46
A Python script for converting YAML-based TextMate grammar definitions to JSON.
"""Convert the YAML source grammar to JSON.
VS Code only supports JSON-based grammars, which is why the source YAML
grammar must be converted into its JSON equivalent before using the
extension.
This script takes care of this, as well as variable insertion, i.e.
converting the string ``${{ var }}`` into the string stored under the
``variables.var`` key of the YAML source file.
@leonhard-s
leonhard-s / experience_ids.md
Created September 23, 2020 17:36
A collection of experience IDs that are not listed in the API

Unknown Experience IDs

Experience ID Amount Loadout IDs Example Other ID
1379 12 4, 5, 10, 18, 20 8739479714, 34380889314, 8740554834, 8739498674, 8739498962, 8740665362
1380 1 18, 4, 5, 1
@leonhard-s
leonhard-s / wait_for_any.py
Created October 16, 2019 12:27
A `discord.py` extension adding support for awaiting multiple websocket events
"""Adds support for multi-event waiting.
This is particularly useful for catching different but closely-related
events, such as `reaction_add` and `reaction_remove`, but it should
support any event type the original `wait_for` event can handle.
Do note that only the first event encountered will be honoured, any
additional events will be dismissed. Also make sure your callback can
handle the event's responses, as they may differ from event to event.
"""
@leonhard-s
leonhard-s / more_helpful_badargument_errors.py
Created September 28, 2019 18:39
Adds standardised attributes to BadArgument exceptions in discord.py
"""Adds standardised attributes to BadArgument exceptions in discord.py.
The default `BadArgument` exception does not have any extra arguments,
and the error messages generated are too different to easily convert
into user-facing error messages.
This extension fixes that by capturing any `BadArgument` exceptions
raised and re-raising them with three extra arguments:
* argument {str} -- The string that could not be converted