This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @author raffy.eth | |
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.23; | |
contract DNSDecoder { | |
function decode(bytes memory dns) external pure returns (string memory s) { | |
unchecked { | |
require(dns.length != 0); | |
bytes memory v = new bytes(dns.length - 1); // [5] 3abc0 => [3] abc, but "abc." so -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.23; | |
import {IERC165} from "@openzeppelin/contracts@4.8.2/utils/introspection/IERC165.sol"; | |
import {ENS} from "https://github.com/ensdomains/ens-contracts/blob/master/contracts/registry/ENS.sol"; | |
import {IExtendedResolver} from "https://github.com/ensdomains/ens-contracts/blob/master/contracts/resolvers/profiles/IExtendedResolver.sol"; | |
import {IMulticallable} from "https://github.com/ensdomains/ens-contracts/blob/master/contracts/resolvers/IMulticallable.sol"; | |
import {BytesUtils} from "https://github.com/ensdomains/ens-contracts/blob/master/contracts/wrapper/BytesUtils.sol"; | |
contract MultiResolver is IERC165, IExtendedResolver { | |
using BytesUtils for bytes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {keccak} from '@adraffy/keccak'; | |
function namehash(name) { | |
let buf = new Uint8Array(64); | |
if (name.length > 0) { | |
for (let label of name.split('.').reverse()) { | |
buf.set(keccak().update(label).bytes, 32); | |
buf.set(keccak().update(buf).bytes, 0); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import struct | |
# chia stuff | |
from chia.wallet.derive_keys import master_sk_to_local_sk | |
from chia.plotting.util import parse_plot_info | |
from chia.types.blockchain_format.proof_of_space import ProofOfSpace | |
# see: chiapos/src/plotter_disk.hpp WriteHeader() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2018 Chia Network Inc | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wktest; | |
import com.antistupid.warbase.data.ArmorCurve; | |
import com.antistupid.warbase.ids.ItemClass; | |
import com.antistupid.warbase.types.ArmorT; | |
import com.antistupid.warbase.types.ClassT; | |
import com.antistupid.warbase.types.EquipT; | |
import com.antistupid.warbase.types.QualityT; | |
import com.antistupid.warbase.types.RaceT; | |
import com.antistupid.warkit.WarKit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void dumpIds() { | |
WarKit wk = WarKit.load(); | |
JSONObject root = new JSONObject(); | |
root.put("items", wk.wearableMap.values().stream().map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new))); | |
root.put("gems", wk.gemMap.values().stream().map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new))); | |
// not all enchants have a corresponding item | |
root.put("enchants", wk.enchantMap.values().stream().filter(x -> x.itemId > 0).map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new))); | |
root.put("foods", wk.consumeMap.values().stream().filter(x -> x.type == ConsumeT.FOOD).map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new))); | |
root.put("potions", wk.consumeMap.values().stream().filter(x -> x.type == ConsumeT.POTION).map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new))); | |
// includes elixirs, flasks, scrolls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package warkit; | |
import warbase.types.SpecT; | |
import warbase.types.ProfT; | |
import warkit.player.Player; | |
public class Main { | |
public static void main(String[] args) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package warbase; | |
import warbase.data.ArmorCurve; | |
import warbase.types.ArmorT; | |
import warbase.types.ClassT; | |
import warbase.types.EquipT; | |
import warbase.types.GemT; | |
import warbase.types.QualityT; | |
import warbase.types.RaceT; | |
import warbase.types.SocketT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package wardbc; | |
import java.nio.file.Paths; | |
import wardbc.lazy.LazyDBC; | |
import wardbc.lazy.rows.*; | |
public class Main { | |
static public void main(String[] args) { | |
NewerOlder