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 / globals.ts
Last active May 7, 2024 18:23
Transpile p5.js global mode to instance mode
/*
Source typefile from here: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/p5/global.d.ts
Used ts-morph to parse the type file and generate a list of all function names and constants.
*/
export default {
functions: [
"describe",
"describeElement",
"textOutput",
@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
@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 / 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 / Renderer.sol
Last active January 13, 2022 19:35
Solidity SVG + Hardhat Hot Reloading Server
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
contract Renderer {
constructor() {
console.log("Deploying render test");
}
@tangert
tangert / smolvid.sh
Last active July 8, 2021 14:39
Just makes videos smol. sensible defaults for ffmpeg
# USAGE:
# smolvid yourmovie.mov
# INSTALL:
# add this to your .bashrc or .zshrc or wherever:
# alias smolvid="bash path/to/smolvid.sh "$1""
# SCRIPT:
# input file
INPUT="$1"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tangert
tangert / .vimrc
Created February 13, 2020 20:57
my vim settings
syntax on
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
@tangert
tangert / SketchSystems.spec
Last active November 8, 2019 18:24
Git side bar
Git side bar
Configuration
Disconnected
Connect to Github -> Connected
Connected
Delete repo -> Deleted
Deleted
Files
No changed files
modify -> Changed
@tangert
tangert / SketchSystems.spec
Last active September 21, 2019 23:00
Primary Screens*
Primary Screens*
Main*
Home*
select group -> Group
select profile -> Profile
Search
Recent activity
Top new posts
Discover
Recent social*