Skip to content

Instantly share code, notes, and snippets.

View erikmd's full-sized avatar
🐓
🐫

Erik Martin-Dorel erikmd

🐓
🐫
View GitHub Profile
@erikmd
erikmd / wall.sh
Created August 1, 2023 21:58 — forked from danmou/wall.sh
Replacement for the unix wall command, which also works with gnome-terminal
#!/bin/bash
usage="
Usage:
wall [options] [message]
Write a message to all users.
Options:
-n, --nobanner do not print banner
@erikmd
erikmd / c99_ub_list.rst
Created April 3, 2023 11:52 — forked from Earnestly/c99_ub_list.rst
C99 List of Undefined Behavior (193 Cases)

C99 List of Undefined Behavior

From N1256: (See http://port70.net/~nsz/c/c99/n1256.html#J.2)

  • A "shall" or "shall not" requirement that appears outside of a constraint is violated (clause 4).
  • A nonempty source file does not end in a new-line character which is not immediately preceded by a backslash character or ends in a partial preprocessing token or comment (5.1.1.2).
  • Token concatenation produces a character sequence matching the syntax of a universal character name (5.1.1.2).
  • A program in a hosted environment does not define a function named main using one of the specified forms (5.1.2.2.1).
  • A character not in the basic source character set is encountered in a source file, except in an identifier, a character constant, a string literal, a header name, a comment, or a preprocessing token that is never converted to a token (5.2.1).
  • An identifier, comment, string literal, character constant, or header name contains an invalid multibyte character or does not
@erikmd
erikmd / server.py
Created February 15, 2023 09:06 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@erikmd
erikmd / Deploy using ssh and docker-compose.md
Last active January 29, 2024 01:34 — forked from jochy/Deploy using ssh and docker-compose.md
[Ubuntu] Deploy a docker-compose from Github Actions using SSH

1. Create SSH keypair

In order to deploy using SSH, we need a SSH keypair. Please use an algorithm strong enough and also supported by GHA and your remote host.

You can use the command below to generate a keypair:

ssh-keygen -t ed25519 -C gha@vm-YourLogin -f ~/.ssh/id_gha

For this use case, don't use a passphrase (just type Return to select an empty passphrase).

@erikmd
erikmd / ocaml_lwt_sample.ml
Last active April 13, 2021 20:38 — forked from mjambon/ocaml_lwt_sample.ml
OCaml/Lwt crash course. Adult supervision recommended.
(*
Interactive approach
--------------------
You can copy-paste code into `utop`, provided you load the lwt.unix
package:
#use "topfind";;
#thread;; (* only needed in the plain `ocaml` toplevel, not in `utop`. *)
#require "lwt.unix";;
@erikmd
erikmd / ANSI.md
Created February 3, 2021 22:52 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1b
  • Decimal: 27