Skip to content

Instantly share code, notes, and snippets.

View tangert's full-sized avatar
🐢
turtles all the way down

Tyler Angert tangert

🐢
turtles all the way down
View GitHub Profile
@tangert
tangert / getAddressChars.sol
Created November 23, 2021 20:56
split a solidity address into its individual characters.
function getAddressChars(address _address)
private
pure
returns (bytes memory)
{
bytes memory hexSymbols = "0123456789abcdef";
uint256 value = uint256(uint160(_address));
uint256 temp = value;
uint256 length = 0;
@tangert
tangert / gensim_word2vec_procrustes_align.py
Last active June 26, 2023 20:01 — forked from quadrismegistus/gensim_word2vec_procrustes_align.py
Function to align any number of word2vec models using Procrustes matrix alignment.
# Code originally ported from HistWords <https://github.com/williamleif/histwords> by William Hamilton <wleif@stanford.edu>.
def align_gensim_models(models, words=None):
"""
Returns the aligned/intersected models from a list of gensim word2vec models.
Generalized from original two-way intersection as seen above.
Also updated to work with the most recent version of gensim
Requires reduce from functools
@tangert
tangert / SVG.sol
Last active April 22, 2024 23:32
SVG Solidity Library
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "./Utils.sol";
// Core SVG utilitiy library which helps us construct
// onchain SVG's with a simple, web-like API.
library svg {
/* MAIN ELEMENTS */
function g(string memory _props, string memory _children)
internal