Skip to content

Instantly share code, notes, and snippets.

View linkdd's full-sized avatar
🙂

David Delassus linkdd

🙂
View GitHub Profile
@linkdd
linkdd / Cargo.toml
Created June 17, 2025 12:36
Test backend to test Hurl performance when stress testing
[package]
name = "hurl-demo-stresstest-backend"
version = "0.1.0"
edition = "2024"
[dependencies]
anyhow = "1"
tokio = { version = "1", features = ["full"] }
hyper = { version = "1", features = ["full"] }
hyper-util = { version = "0.1", features = ["full"] }
@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 / hackernews-new-comms.js
Last active August 25, 2024 11:15
Add a bell emoji to unread comments on HackerNews
// Can be used with https://github.com/xcv58/Custom-JavaScript-for-Websites-2
// This snippet is released under the terms of the CC0 license: https://creativecommons.org/publicdomain/zero/1.0/deed.en
const cache_key = 'hn_comments_views'
const cache = JSON.parse(localStorage.getItem(cache_key) || '{}')
document.querySelectorAll('.athing.comtr').forEach(comm => {
if (!cache[comm.id]) {
const span = document.createElement('span')
span.innerHTML = '🔔' // :bell: emoji
@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 / 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 / get-docker-host.sh
Created January 23, 2022 03:05
Get Docker Host IP Address
#!/bin/sh
cat <<EOF | docker run --rm -i alpine:latest sh
apk add --no-cache iproute2 >/dev/null
ip -4 route show default | cut -d' ' -f3
EOF
@linkdd
linkdd / enter-chroot.bash
Created July 4, 2012 09:15
Script to manage chroot
#!/bin/bash
if [ "$UID" != "0" ]
then
echo "You have to be root" >&2
exit 1
fi
CHROOT=$1
@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
});