Skip to content

Instantly share code, notes, and snippets.

View linkdd's full-sized avatar
🙂

David Delassus linkdd

🙂
View GitHub Profile
@linkdd
linkdd / netbox-openapi.json
Created November 11, 2024 12:39
Ntbox 3.6.9 OpenAPI + a few plugins
This file has been truncated, but you can view the full file.
{
"openapi": "3.0.3",
"info": {
"title": "NetBox REST API",
"version": "3.6.9 (3.6)",
"license": {
"name": "Apache v2 License"
}
},
"paths": {
@linkdd
linkdd / qr_noise.hpp
Created August 28, 2023 03:39
Noise function for QR (Cubic/Axial) coordinate system (for hexagonal maps)
#pragma once
#include <algorithm>
#include <array>
#include <random>
#include <glm/vec3.hpp>
#include <hex/coords.hpp>
@linkdd
linkdd / trollworks-gui.hpp
Last active April 30, 2023 22:53
EnTT + ImGui framework similar to React
#pragma once
#include <type_traits>
#include <concepts>
#include <functional>
#include <stdexcept>
#include <optional>
#include <vector>
#include <tuple>
@linkdd
linkdd / letlang_block_skel.rs
Created September 23, 2022 16:15
Letlang basic structure of a block of code
let task_args: Vec<Value> = vec![];
let mut block = func.call(&mut context, task_args);
let ignored = Value::Boolean(bool::default());
let mut state = block.resume_with(ignored);
loop {
match &state {
GeneratorState::Yielded(FunctionInterruption::Effect { name, args }) => {
// try to handle side effect
@linkdd
linkdd / letlang_process_skel.rs
Created September 23, 2022 16:09
Basic structure of a Letlang process implementation
tokio::spawn(async move {
let process_handle = tokio::spawn(async move {
// run process's function
});
let res = process_handle.await;
// notify the node of the process termination
});
@linkdd
linkdd / 00_README.md
Last active September 7, 2022 00:14
Letlang Hello world program and its Rust output

Letlang Hello World

The Letlang compiler translates the Letlang code to Rust code.

The structure is as follow:

  • lib/src/std/
    • io.let (see 11_std_io.let)
  • examples/hello-world/
  • letproject.toml
@linkdd
linkdd / lib.rs
Created May 13, 2022 23:21
First Letlang module compiled
#[allow(unused_variables)]
#[allow(unused_imports)]
#[allow(dead_code)]
mod symbol_a {
use llcore_runtime::*;
pub fn const_a(context: Arc<Mutex<Context>>) -> Value {
Value::Primitive(PrimitiveValue::Number(42.0))
}
@linkdd
linkdd / node.dockerfile
Last active August 19, 2022 20:07
Javascript SPA with NginX dockerfile
# Tooling configuration files
FROM scratch AS context
ADD package.json \
yarn.lock \
.eslintrc.js \
.eslintignore \
/workspace/
# Source code
@linkdd
linkdd / README.md
Last active February 5, 2024 11:21
Python Django Dockerfile

Python Django Dockerfile

When setting up a Python/Django project, I like to do a few things:

  • use poetry to manage dependencies and virtualenv
  • use poe to manage tasks (similar to node's scripts)
  • split the django settings.py into multiple files, with one per environment (similar to Elixir compile-time config)
  • use gunicorn and whitenoise to serve the application
  • use a multi-stage Dockerfile making heavy use of the docker layer cache to avoid running intensive steps needlessly
  • use django-tailwind and django-anymail
@linkdd
linkdd / return-generator.rs
Created May 11, 2022 09:29
Return Rust generator from function
use genawaiter::{sync::gen, yield_, Generator};
type MyGen = Box<dyn Generator<Yield = i32, Return = i32>>;
fn make_generator() -> MyGen {
let gen = gen!({
yield_!(1);
yield_!(2);
yield_!(3);
4