Skip to content

Instantly share code, notes, and snippets.

View vberlier's full-sized avatar

Valentin Berlier vberlier

  • Paris, France
View GitHub Profile
@tomplex
tomplex / pydantic_redirecting_type.py
Created April 26, 2020 06:28
Use Pydantic to dynamically create specific implementations of an ABC based on input data
import abc
import typing
import pydantic
class File(pydantic.BaseModel, abc.ABC):
@classmethod
def __get_validators__(cls):
# one or more validators may be yielded which will be called in the
@Akryum
Akryum / List.vue
Created December 15, 2019 14:40
Vue - onScrollBottom composable function
<script>
import { ref } from '@vue/composition-api'
import { onScrollBottom } from '@/scroll'
export default {
setup () {
function loadMore () {
// ...
}
@dabeaz
dabeaz / README.txt
Created October 15, 2019 20:10
PyCon India 2019, Code from Keynote Presentation by @dabeaz
Code from PyCon India 2019 Keynote Talk
David Beazley (https://www.dabeaz.com)
======================================
This code is presented "as is" and represents what was live-coded
during my closing keynote presentation at PyCon India, Chennai,
October 13, 2009. I have made no changes to the files.
Requires: Python 3.6+, numpy, pygame
use std::{
f32,
io
};
use minifb::{
Key,
WindowOptions,
Window,
};
use vek::*;
# source:http://reocities.com/SiliconValley/heights/7052/opcode.txt
From: mark@omnifest.uwm.edu (Mark Hopkins)
Newsgroups: alt.lang.asm
Subject: A Summary of the 80486 Opcodes and Instructions
(1) The 80x86 is an Octal Machine
This is a follow-up and revision of an article posted in alt.lang.asm on
7-5-92 concerning the 80x86 instruction encoding.
The only proper way to understand 80x86 coding is to realize that ALL 80x86
@Bentroen
Bentroen / pca_model_deanimator.py
Last active August 9, 2018 07:23
#PokeCA Model De-animator | Extract frames from animated Pokémon
########################################################################################
# #PokeCA Model De-animator by Bentroen #
########################################################################################
# #
# Usage instrucions: point 'input_path' to a folder containing the 'models' and #
# 'textures' folders from the original map's resource pack. The script will #
# fetch the correct model according to 'model_list', and export the following #
# to 'output_path': every frame to 'models/all_frames/', every first frame to #
# 'models/' and first frame of textures to 'textures/'. If the texture itself #
# is animated (changes from frame to frame, e.g. Ternion's blue fire), only #
@dgilge
dgilge / 01_complete_authentication_as_api.md
Created June 15, 2018 11:15
How to implement all needed auth endpoints including login with OAuth2 for a SPA using Django REST framework, django-rest-auth and django-allauth

Complete authentication as API including OAuth2 endpoints

I implemented an auth API for a SPA. This is rarely documented and therefore I want to share here how I did it hoping it will be a help for others.

We are still working on it and I'll update this document accordingly.

This tutorial uses following versions:

Package Version
@dutc
dutc / defaults.py
Created June 14, 2018 21:36
PEP 563 -- Postponed Evaluation of Annotations (https://www.python.org/dev/peps/pep-0563/)
from __future__ import annotations
from inspect import signature
from functools import wraps
from collections import namedtuple
opt = namedtuple('Optional', '')()
def better_defaults(f):
sig = signature(f)
@wraps(f)
def func(*args, **kwargs):
@Fumesover
Fumesover / List.md
Last active February 18, 2019 00:08
Fiches destinations S4
@Podshot
Podshot / chunk_reader.py
Last active September 20, 2023 21:04
Proof of Concept for converting BlockState Long IDs to Palette indices. Critical for loading 1.13 Minecraft Java Edition worlds. Run with the command: "python proof_of_concept.py" to use. If you use any snippet of code from this, please give appropriate credit to the respective authors.
"""
Standalone chunk loader/reader from pymclevel with all the fancy repair/OOP stuff removed
"""
from __future__ import unicode_literals, print_function
import os
try:
from pymclevel import nbt
except ImportError:
import nbt
import struct