Skip to content

Instantly share code, notes, and snippets.

View maxux's full-sized avatar
🔑

Maxime Daniel maxux

🔑
View GitHub Profile
import argparse
import requests
def generatetoken(clientid, clientsecret, organization=None, validity=None):
params = {
'grant_type': 'client_credentials',
'client_id': clientid,
'client_secret': clientsecret,
'response_type': 'id_token',
'scope': 'offline_access'
@maxux
maxux / kexec-debug.c
Last active November 29, 2021 08:01
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <linux/reboot.h>
#include <sys/reboot.h>
#include <sys/syscall.h>
#include <linux/kexec.h>
#include <sys/types.h>
#!/bin/bash
set -ex
# make output directory
ARCHIVE=/tmp/archives
FLIST=/tmp/flist
mkdir -p $ARCHIVE
# install system deps
apt-get update
@maxux
maxux / zos-vbox-offline.sh
Last active October 11, 2018 00:22
Zero-OS VirtualBox Bootdisk (offline tool, doesn't download kernel on each boot)
#!/bin/bash
set -e
usage() {
echo "Zero-OS VirtualBox Offline Bootdisk Tool"
echo ""
echo " ./zos-vbox-offline.sh <image-file.vdi> [branch] [zerotier] [kernel arguments]"
echo ""
echo "All arguments except image-file are optional, see default value below"
echo ""
from zeroos.core0.client import Client
import sys
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Missing zero-host host")
sys.exit(1)
hostname = sys.argv[1]
@maxux
maxux / Docker
Last active August 13, 2018 19:05
Hub Converter
docker run -it --rm \
--device /dev/fuse \
--privileged \
--name hub-converter \
--net hub \
--hostname hub-converter \
-v /mnt/hub/:/mnt/hub \
ubuntu:16.04
#!/bin/bash
set -ex
makeopts="-j 5"
apt-get update
apt-get install -y build-essential
apt-get install -y git libsnappy-dev libz-dev libtar-dev libb2-dev
apt-get install -y autoconf libtool libjansson-dev libhiredis-dev libsqlite3-dev
#!/bin/bash
set -ex
target="/tmp/g8ufs-debug"
zrfsbin="/opt/code/go/src/github.com/zero-os/0-fs/g8ufs"
[[ $UID != 0 ]] && (echo "[-] root privileges needed" && exit 1)
[[ -z $1 ]] && (echo "[-] missing flist url" && exit 1)
echo "[+] cleaning previous workspace"

BetterToken Node Setup

Setup USB Disk

  1. Download the UEFI Bootloader: https://bootstrap.gig.tech/uefi-provision
  2. Create a single partition on the USB Disk and format it in FAT (vfat, fat16, fat32, all should works)
  3. Create directory EFI/BOOT on the USB Disk
  4. Copy the downloaded file from point 1. to EFI/BOOT/BOOTX64.EFI (on the USB Disk)

Setup the Server

  1. Set the USB Disk as first (and unique) boot device, in boot order
/:
-rwxr-xr-x root root 0 ( 0 blocks) .dockerenv
drwxr-xr-x root root 0 ( --- ) bin
drwxr-xr-x sys sys 0 ( --- ) dev
drwxr-xr-x root root 0 ( --- ) etc
drwxr-xr-x nobody nogroup 0 ( --- ) home
drwxr-xr-x root root 0 ( --- ) proc
drwxr-xr-x root root 0 ( --- ) root
drwxr-xr-x root root 0 ( --- ) sys
drwxrwxrwx root root 0 ( --- ) tmp