Skip to content

Instantly share code, notes, and snippets.

View nickelpro's full-sized avatar
suzmarin

Vito Gamberini nickelpro

suzmarin
View GitHub Profile
module EdgeSync (
input clk,
input nReset,
input in,
output rise,
output fall,
output logic out
@nickelpro
nickelpro / mcvarint.py
Created November 5, 2013 02:20
Two python functions that implement the new Minecraft varint type (32-bit signed integers packed into Google protobuf varints). Packs varints into a byte string, unpacks varints from a buffer that has a read(bytes) method. Supports negative numbers even though they aren't used in the current protocol.
import struct
def pack_varint(val):
total = b''
if val < 0:
val = (1<<32)+val
while val>=0x80:
bits = val&0x7F
val >>= 7
total += struct.pack('B', (0x80|bits))
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
// None of these headers are available in xv6, in xv6 you only need to the
// "user.h" header
/**
* @brief Prints a region of memory to stdout as hex digits
async function applyDivineFury(token, tactor, tokenId, type, origin) {
let damage = ` + (1d6 + ${(args[1] / 2) | 0})[${type}]`
let duration;
if (game.combat) {
duration = {
startRound: game.combat.round,
rounds: 0,
turns: 1
}
@nickelpro
nickelpro / yggdrasil.py
Created October 16, 2013 21:51
Yggdrasil Authentication implementation for Minecraft, implements all known Yggdrasil methods and is a lot simpler than some of the other implementations floating around
import urllib.request as request
from urllib.error import HTTPError
import json
class YggAuth:
def __init__(self,
client_token=None,
access_token=None,
username=None,
password=None
@nickelpro
nickelpro / logger.cpp
Created December 21, 2021 04:48
Logger from my last project
#include "logger.hpp"
vea::Logger VEA_SIMPLE_LOGGER;
namespace vea {
const char* lvl_strings[] {"trace", "debug", "info", "warn", "fatal"};
Logger::Logger(const std::string& name) : name(name) {}
const lastArg = args[args.length - 1]
let act = await fromUuid(lastArg.actorUuid)
let calmData = {
"changes": [{ "key": "macro.itemMacro", "mode": 0, "value": 0, "priority": 20 }],
"origin": lastArg.origin,
"icon": "systems/dnd5e/icons/skills/red_02.jpg",
"label": "Berserker Calm",
"transfer": true,
"flags": {
"dae": {
#ifndef NBT_HPP
#define NBT_HPP
#include "byteswap.hpp"
#include <bit>
#include <concepts>
#include <cstdint>
#include <iostream>
#include <map>
#include <optional>
@nickelpro
nickelpro / vec3.hpp
Last active May 18, 2021 16:42
Riker's Vec3 Header
#ifndef RKR_VEC3_HPP
#define RKR_VEC3_HPP
#include <array>
#include <cstdint>
#include <immintrin.h>
#include <stdalign.h>
#include <stdexcept>
#include <string>
/*
This file was generated by mcd2cpp.py
It should not be edited by hand.
*/
#include "proto_1_16_1.hpp"
namespace mcd {
const char* serverbound_handshaking_cstrings[] = {