Skip to content

Instantly share code, notes, and snippets.

@matthewjberger
matthewjberger / Cargo.toml
Last active April 17, 2022 15:33
An example of creating and serializing an ecs world with legion ecs in rust
[dependencies]
legion = "0.4.0"
serde = "1.0.125"
serde_json = "1.0.64"
@deya-0x
deya-0x / Godot Merge MeshInstances vertex data snippet
Last active April 5, 2021 06:08
This is just an excerpt of my MeshInstance merge code. This is not meant to create a true single merged mesh for visual use, but to create a single MeshInstance so we can pass the combined vertex data to Detour/Recast for use with https://github.com/TheSHEEEP/godotdetour
private Godot.Collections.Array meshInstances;
private MeshInstance combinedMeshInstance;
private void mergeChildren(bool useLocalSpace = false)
{
findAllMeshInstances(this);
ArrayMesh tempMesh = new ArrayMesh();
SurfaceTool surfaceTool = new SurfaceTool();
surfaceTool.Begin(Mesh.PrimitiveType.Triangles);
@xdl
xdl / Console.gd
Created June 11, 2020 23:36
Godot debug/interpreter console
extends Control
# Mostly inspired off https://www.youtube.com/watch?v=80cwYGvKB9U
# and https://github.com/godotengine/godot/issues/8003
onready var input_node: LineEdit = $Input
onready var output_node: TextEdit = $Output
# Dump some commands in here for convenience
var history = ["get_tree().get_root().get_node('Main')"]
@Akendo
Akendo / netmask_to_cidr.py
Created May 24, 2017 11:23
Converting a netmask to CIDR with vanilla python
def netmask_to_cidr(m_netmask):
return(sum([ bin(int(bits)).count("1") for bits in m_netmask.split(".") ]))
@weavenet
weavenet / delete_all_object_versions.sh
Created May 4, 2015 05:21
Delete all versions of all files in s3 versioned bucket using AWS CLI and jq.
#!/bin/bash
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`