Skip to content

Instantly share code, notes, and snippets.

@SupremeMortal
SupremeMortal / HashPaletteComparator.java
Created April 19, 2022 21:08
Bedrock's new block palette ordering
public class HashedPaletteComparator implements Comparator<String> {
public static final HashedPaletteComparator INSTANCE = new HashedPaletteComparator();
private static final long FNV1_64_INIT = 0xcbf29ce484222325L;
private static final long FNV1_PRIME_64 = 1099511628211L;
@Override
public int compare(String o1, String o2) {
byte[] bytes1 = o1.getBytes(StandardCharsets.UTF_8);
byte[] bytes2 = o2.getBytes(StandardCharsets.UTF_8);
@tuxuser
tuxuser / xbl_oauth2.py
Created September 2, 2020 09:15
Sign in to Xbox Live with OAUTH2
"""
Sign in to Xbox Live with OAUTH2
1. Go to https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
2. Register new app ("+ New registration")
2.1. Enter a name for your app
2.2. Set "Supported account types" to "Personal Microsoft accounts only"
2.3. Click register
2.4. Choose "Redirect URIs" -> "Add a Redirect URI"
2.5. Click "Add a platform" -> "Mobile and desktop applications"
@shinyquagsire23
shinyquagsire23 / gist:f7907fdf6b470200702e75a30135caf3
Created January 8, 2020 05:48
Philips Hue BLE Services and Characteristics (WIP)
DeviceInfo(softwareRevision, isOn,
SceneLightState(color, powerOnBehavior, deviceInfo
Light(id,
Capabilities(dimmable, customState
PowerOnBehavior(option
hueplay, huebloom, hueiris, huelightstrip, huego, plug, bollard, wallspot, groundspot, flexiblelamp, wallshade, walllantern
[ea:44:13:bd:db:59] Service [b8843add-0000-4aa1-8794-c3f462030bda] Unknown, ble_firmware_update?
[ea:44:13:bd:db:59] Characteristic [b8843add-0004-4aa1-8794-c3f462030bda]
@taylor224
taylor224 / wifi.py
Last active July 11, 2024 20:17
Python WiFi Example
# -*- coding: utf-8 -*-
import wifi
def Search():
wifilist = []
cells = wifi.Cell.all('wlan0')