Skip to content

Instantly share code, notes, and snippets.

View maxux's full-sized avatar
🔑

Maxime Daniel maxux

🔑
View GitHub Profile
@maxux
maxux / PKGBUILD
Last active December 12, 2023 20:00
Arch tfchain build script
pkgname="tfchain"
pkgver="2.6.0"
pkgrel="1"
pkgdesc="Threefold TFChain"
arch=("x86_64")
source=("https://example.com/${pkgname}-${pkgver}.tar.gz")
source=("https://github.com/threefoldtech/tfchain/archive/refs/tags/v${pkgver}.tar.gz")
license=("custom")
sha256sums=("a9059ae45895fff39d3eeeeaad2eda1298103d9f66232fca826d86f940cea010")
makedepends=("base-devel" "protobuf" "clang" "llvm" "gcc12" "rustup")
@maxux
maxux / gentoo-base-chroot.sh
Last active November 30, 2023 00:44
Gentoo Base Install Scripts
#!/bin/bash
gentoo="/home/gentoo"
mirror="https://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/releases/amd64/autobuilds"
latest=$(curl -s ${mirror}/latest-stage3-amd64-openrc.txt | grep openrc | awk '{ print $1 }')
baselat=$(basename $latest)
mkdir -p ${gentoo}
cd ${gentoo}
@maxux
maxux / sqlite3-mysql-gateway.py
Last active October 24, 2023 00:02
SQLite3 MySQL Gateway
import sqlite3
db = sqlite3.connect("power-buffer.sqlite3")
cursor = db.cursor()
buffer = []
print("[+] fetching rows")
cursor.execute("SELECT * FROM power")
@maxux
maxux / hddtemp-smartctl.py
Last active July 9, 2023 20:49
HDD Temperature over smartctl when hddtemp doesn't works
import subprocess
import sys
import json
drives = [
"/dev/sda",
"/dev/sdb",
"/dev/sdc",
"/dev/sdd",
"/dev/sde",
module main
import os
import libsodium
import freeflowuniverse.crystallib.mnemonic
fn seed_from_random() []u8 {
mut seed := []u8{}
for _ in 0 .. 32 {
seed << u8(libsodium.randombytes_random())
{ stdenv, fetchFromGitHub, lib }:
stdenv.mkDerivation rec {
pname = "zdb";
version = "development-v2";
src = fetchFromGitHub {
owner = "threefoldtech";
repo = "0-db";
rev = version;

I put some work on a way to rethink how the current capacity computing and reward system works. ThreeFold main goal and philosophy is fair an equity to make a better world for everybody.

The current way on how we compute, reward and show grid capacity only rely on 'numbers' (amount of cores, amount of GBs of storage, ...). This way of thinking and computing was pretty good in a first step, to get the grid alive. It's now time to make it more robust and more fair.

We need to keep in mind couple things:

  • It's important to reuse old hardware and not throw it away if it still works
  • In this always evolving world, some application needs high power machine, we need some good hardware too
@maxux
maxux / r710-zos.md
Created May 25, 2022 13:22
Zero-OS Dell PowerEdge

Dell PowerEdge R710 - Zero-OS

This tutorial explain how to boot Zero-OS v3 on a Dell PowerEdge R710, using vDisk and iDRAC. No external USB drive needed. This require iDRAC Enterprise.

Zero-OS Bootloader

First, you need to download your booloader. This is needed for any system to boot. With the vFlash, you can use disk image and avoid external USB.

@maxux
maxux / humanread.c
Last active April 19, 2024 19:34
Human readable size to bytes in C
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>
#include <string.h>
static char *human_readable_suffix = "kMGT";
size_t *parse_human_readable(char *input, size_t *target) {
char *endp = input;
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <ctype.h>
#include <errno.h>
#include <unistd.h>