Skip to content

Instantly share code, notes, and snippets.

View rene-d's full-sized avatar
🤘
Let There Be Rock

rene-d rene-d

🤘
Let There Be Rock
  • Thales
  • France
View GitHub Profile
@rene-d
rene-d / README.md
Last active September 16, 2022 04:30
Serve an ISO image in a HTTP server.

tl-iso-server.py

Serve an ISO image in a HTTP server. Designed for use with TeX Live, but should work for any ISO image.

Very suitable for offline and non-root environments, especially if you cannot mount -o loop the image.

Requirements

#!/usr/bin/env python3
import numpy as np
import matplotlib.pyplot as plt
from math import radians, degrees, pi, sin, asin, cos, atan2, sqrt, acos
EARTH_RADIUS = 6371
def wingman_coord(latitude, longitude, altitude, heading, wingman_angle, wingman_distance):
@rene-d
rene-d / sctptest.c
Last active April 13, 2022 19:46 — forked from zonque/sctptest.c
Simple client/server test for SCTP
/*
* Compile:
*. apt-get install -y libsctp-dev
* gcc sctptest.c -o server -lsctp -Wall
* ln -s server client
*
* Invoke:
*
* ./server
* ./client
@rene-d
rene-d / hexdump.c
Last active September 16, 2022 04:26
ultra fast dump function in C (output like hexdump -C)
// ultra fast dump function (output like hexdump -C)
void hexdump(const void *data, size_t size)
{
static const char digits[] = "0123456789abcdef";
char line[80]; // we use 79 chars at most
size_t i;
int j;
for (i = 0; i < size; i += 16)
{
@rene-d
rene-d / server.py
Created March 21, 2022 16:04 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
class S(BaseHTTPRequestHandler):
FROM alpine:edge AS toilet-builder
RUN apk update && apk add gcc musl-dev make curl unzip findutils fdupes
WORKDIR /build
# figlet
RUN curl -skL -o figlet-master.zip https://github.com/cmatsuoka/figlet/archive/refs/heads/master.zip && \
unzip -q -o figlet-master.zip && \
@rene-d
rene-d / Cargo.toml
Last active January 16, 2022 06:45
Rust cross-compilation example (on Apple Silicon with Docker)
[package]
name = "hello"
version = "0.1.0"
edition = "2021"
[dependencies]
[[bin]]
name = "hello"
path = "hello.rs"
@rene-d
rene-d / bashdb.sh
Last active November 9, 2023 07:29
Little debugger for bash scripts
#!/bin/echo must be source:
# bash debugger
# Rene Devichi. https://unlicense.org
# Usage: `source bashdb.db` at the beginning of your script
# Inline version:
# curl -sL -o /tmp/bashdb.sh https://gist.github.com/rene-d/fd2d2c37dfc1371255818d73f7b5f1db/raw/bashdb.sh
# trap "rm -f /tmp/bashdb.sh" EXIT
# . /tmp/bashdb.sh
@rene-d
rene-d / eject
Created May 15, 2021 09:42
The missing eject command in macOS
alias eject="diskutil list | sed -nr '/external, physical/s,^/dev/disk([0-9]+) .*,\1,p' | xargs -I+ diskutil eject /dev/rdisk+"
@rene-d
rene-d / shell_colors
Last active November 27, 2024 13:38
Show ANSI color sequences in a terminal
#!/usr/bin/env bash
# https://en.wikipedia.org/wiki/ANSI_escape_code
print_colors()
{
# Print column headers.
printf "%-4s " '' ${bgs[@]}
echo