Skip to content

Instantly share code, notes, and snippets.

View stelabouras's full-sized avatar
😎

Stelios Petrakis stelabouras

😎
View GitHub Profile
@lorentey
lorentey / noncopyable-stdlib-primitives.md
Last active May 3, 2024 03:54
Noncopyable Standard Library Primitives (draft proposal)

Noncopyable Standard Library Primitives

  • Proposal: SE-NNNN
  • Authors: Karoy Lorentey
  • Review Manager: TBD
  • Status: Forum pitch
  • Roadmap: [Improving Swift performance predictability: ARC improvements and ownership control][Roadmap]
  • Implementation: On main and release/6.0, gated behind -enable-experimental-feature NoncopyableGenerics
  • Pitch thread: (pitch)
@daniel-ilett
daniel-ilett / TriangleTexturePlugin.cs
Created April 27, 2024 17:48
A Unity editor script which takes a mesh and generates a texture based on the UVs where each triangle is assigned a random greyscale color (place the script inside a folder named Editor).
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEditor;
using UnityEditor.UIElements;
// Based on: https://forum.unity.com/threads/save-rendertexture-or-texture2d-as-image-file-utility.1325130/
public class TriangleTexturePluginWindow : EditorWindow
@q3k
q3k / hashes.txt
Last active April 14, 2024 17:11
liblzma backdoor strings extracted from 5.6.1 (from a built-in trie)
0810 b' from '
0678 b' ssh2'
00d8 b'%.48s:%.48s():%d (pid=%ld)\x00'
0708 b'%s'
0108 b'/usr/sbin/sshd\x00'
0870 b'Accepted password for '
01a0 b'Accepted publickey for '
0c40 b'BN_bin2bn\x00'
06d0 b'BN_bn2bin\x00'
0958 b'BN_dup\x00'
@charles-l
charles-l / collision.py
Last active April 1, 2024 21:35
Simple collisions for action games (raylib python). Blog post: https://c.har.li/e/2024/03/28/implementing-robust-2D-collision-resolution.html
# `pip install raylib` to get pyray
import pyray as rl
from dataclasses import dataclass
import random
from typing import Optional
SIZE = 32
def copy_rect(rect):
@OrionReed
OrionReed / dom3d.js
Last active May 3, 2024 12:42
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@loreanvictor
loreanvictor / RISS.md
Last active March 16, 2024 09:32
Interaction as Content

Can We Get More Decentralised Than The Fediverse?

I guess that the [fediverse][fediverse] will be as decentralised as email: a bit, but not that much. Most people will be dependent on a few major hubs, some groups might have their own hubs (e.g. company email servers), personal instances will be pretty rare. This is in contrast to personal blogging, where every Bob can easily host their own (and they often do). I mean that's already implied by the name: fediverse is [a federated universe, not a distributed one][fed-v-dis].

Why does this matter? Well I like not being dependent on one entity, but I would like it much more if I was dependent on no entities at all. In other words, I like to publish my own personal blog and get all the goodies of a social network, without being dependent on other micro-blogging / social content platforms.

So in this writing, I'm going to:

  • ❓ Contemplate on why the fediverse gets federated not distributed (spoilers: its push vs pull)
  • 🧠 Ideate on how could we get a distri
@cote
cote / gist:075e2543f9ba716966cfefc86a577b12
Last active April 2, 2024 05:08
How to use AI for B2B by learning playing D&D - Part 01: Goblin Arrows
How to use AI for B2B by learning playing D&D - Part 01: Goblin Arrows
Can ChatGPT be a good Dungeons Master for Dungeons and Dragons? How can you use ChatGPT for B2B marketing and strategy? These are the two questions I’m figuring out by learning how to play D&D in generative AI tools.
In this first episode, the ChatDM and I start cold with the classic Goblin Arrows chapter in The Lost Mines of Phandelver.
See my notes here:
https://gist.github.com/cote/075e2543f9ba716966cfefc86a577b12/edit

Preface

I'm comparing Godot mostly to Unity due to my ~10 years of Unity experience. I'm also primarily working in 3D and C# and that is what I want to use Godot for.

Terms:

  • by "export" I mean a variable exposed in the inspector, that's how Godot calls them
  • I use the word "prefab" to mean a scene that is intended to be instantiated multiple times, unlike a "level"
  • Godot's Resources == Unity's ScriptableObjects
  • Godot's collision shapes == Unity's colliders

Pros

@snej
snej / missing_includes.rb
Created October 2, 2023 16:19
Script to find missing std #includes in C++ headers
#! /usr/bin/env ruby
#
# missing_includes.rb
# By Jens Alfke <jens@couchbase.com>
# Version 2.0 -- 2 Oct 2023
# Copyright 2021-Present Couchbase, Inc.
#
# This script scans C++ header files looking for usage of common standard library classes, like
# `std::vector`, without including their corresponding headers, like `<vector>`. It similarly looks
# for standard C functions like `strlen` that are used without including their header (`<cstring>`.)
@Donnotron666
Donnotron666 / EdgeMap.hlsl
Created September 24, 2023 17:27
Consume Edge Maps on the GPU
void getSpriteEdges_float(UnityTexture2D edgeMap, UnitySamplerState ss, float2 uv, out float top, out float right, out float left, out float bot) {
//MY COUNTERPART IS EdgeMapUtils.GetEdge
float4 color = edgeMap.Sample(ss, uv);
top = color.r;
right = color.g;
left = color.b;
bot = color.a;