Skip to content

Instantly share code, notes, and snippets.

@antont
antont / console_log
Created September 9, 2024 11:44
console log
[14:40:45.486 INF Connection:0000000002] Client handshake completed with (127.0.X.X-384e9d4f): clientVersion=0.0.2, localPort=9339, targetHostname=<null>
[14:40:45.486 DBG Connection:0000000002] Received Handshake.ClientHello{ ClientVersion=0.0.2, BuildNumber=, SupportedLogicVersions=MetaVersionRange{ MinVersion=2, MaxVersion=2 }, FullProtocolHash=2064835897, CommitId=, Timestamp=2024-09-09 11:40:45.467 Z, AppLaunchId=3981582898, ClientSessionNonce=2802025118, ClientSessionConnectionNdx=0, Platform=Unknown, LoginProtocolVersion=2, TargetHostname=null, ClientLogicVersion=2 }
[14:40:45.492 DBG Connection:0000000002] Request device login for Player:YNAVwH959i (deviceId=v8l03u1aZBK67vWJY7aKxr4UnzZfADTzoCM7uetKMErMIvKd, isBot=False)
[14:40:45.496 DBG Connection:0000000002] Authentication succeeded for Player:YNAVwH959i (deviceId=v8l03u1aZBK67vWJY7aKxr4UnzZfADTzoCM7uetKMErMIvKd)
[14:40:45.497 INF Connection:0000000002] Logged in Player:YNAVwH959i, key=DeviceId/v8l03u1aZBK67vWJY7aKxr4UnzZfADTzoCM7uetKMErMIvKd)
[14:4
@antont
antont / PlayerId.cs
Created August 29, 2024 06:32
Metaplay PlayerId type
/* Claude Sonnet says:
Yes, it is possible to define entity kind specific EntityId types, such as PlayerId.
While the `EntityId` struct in the provided code is designed to be a general-purpose identifier for various entity types,
you can create wrapper types for specific entity kinds to improve type safety and readability in your code. */
public readonly struct PlayerId : IEquatable<PlayerId>
{
private readonly EntityId _entityId;
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial;}
/* Style the tab */
.tab {
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {font-family: Arial;}
/* Style the tab */
.tab {
@antont
antont / asynctask_thread.py
Last active October 6, 2023 10:22
Python thread to run async tasks in the background, in a single eventloop & thread
import threading
import asyncio
from queue import Queue
import time
from typing import Awaitable
import flask
from firebase_functions.private import serving
concurrent_handler_id = 0
"""
fastapi-cache decorator modified for SQLModel use.
Also, caches and serves the final JSON, instead of Python objects.
Thus looses pydantic validation of the response objects up in fastapi,
but this cache func does `response_model.from_orm` itself, so runs the same validation.
Elsewhere, there's an example that uses unmodified fastapi-cache with SQLModel, that works too
https://github.com/jonra1993/fastapi-alembic-sqlmodel-async/blob/main/fastapi-alembic-sqlmodel-async/app/api/v1/endpoints/cache.py
"""
@antont
antont / Time Series Multi-Line.md
Created September 10, 2018 10:58 — forked from jonmitten/Time Series Multi-Line.md
Temperature Graph with threshold lines

A graph that interprets IoT temperature device through time, tracking internal to a refrigerator and external to a refrigerator.

Written in D3, and visible here

Gist available here

@antont
antont / csv2cue.py
Last active June 18, 2023 13:38
Serato History CSV to Mixcloud compatible CUE converter, with time offset
import csv
import datetime
session_start_time = datetime.datetime(2018, 8, 31, 22, 57, 27)
print("FILE \"swingit_vol1.mp3\" MP3")
with open('edit-31.8.2018.csv') as csvfile:
reader = csv.reader(csvfile)
@antont
antont / Toggle3D.cs
Created November 11, 2017 21:48
Unity: Toggle3D and ToggleGroup3D, for selecting 3D objects similarily to how Unity.UI Toggles and ToggleGroup works. Ported from those counterparts.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Toggle3D : MonoBehaviour {
// group that this toggle can belong to
[SerializeField]
private ToggleGroup3D m_Group;
import json
import sys
F = sys.argv[1]
print(F)
#F = "just60.json"
#F = "c-asus_nvidia.json"
#F = TimelineRawData-20160412T120624.json"