Skip to content

Instantly share code, notes, and snippets.

View multun's full-sized avatar

Victor Collod multun

View GitHub Profile
sh-5.0$ alias atroce='func('
sh-5.0$ atroce
sh: syntax error near unexpected token `newline'
sh-5.0$ atroce ) {
> echo vraiment atroce
>
> }
sh-5.0$ if true; then
> alias machin='echo hm ok'
> machin
@multun
multun / embed_printf.c
Last active October 18, 2019 22:28
Embed printf from iPXE
/*
* Copyright (C) 2006 Michael Brown <[email protected]>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@multun
multun / emacs-base.el
Created September 9, 2019 19:00
emacs-base.el
(setq c-default-style "bsd"
c-basic-offset 4)
(setq-default indent-tabs-mode nil)
(require 'whitespace)
(setq require-final-newline t)
(setq whitespace-style '(face empty tabs trailing lines-tail))
(global-whitespace-mode t)
@multun
multun / gist:ff5f938080caa8c13d650cae6f87cb5f
Created June 1, 2019 19:17
Iptables filter non-root traffic
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
@multun
multun / message_json_parser.py
Created December 26, 2018 22:51
Pretty-print a facebook message.json, fixing up broken encoding
import sys
import json
from datetime import datetime
def fixup_str(text):
return text.encode('latin1').decode('utf8')
def fixup_list(l):
@multun
multun / malloc.md
Last active October 18, 2019 23:30
malloc.md

Introduction

Il y a beaucoup, mais alors beaucoup de manières d'implémenter un allocateur mémoire. Trop pour les lister ici sans y passer vraiment beaucoup de temps. Ainsi, seuls les aspects généraux seront évoqués.

Debug son malloc

Si vous lisez ce message, c'est que votre malloc ne marche pas. Terrible, non ? Que faire !

Généralités

@multun
multun / shell.md
Last active January 11, 2020 08:55
implémenter un shell, douilles et architecture

Le document a été migré ici

@multun
multun / workspace.sh
Last active April 20, 2020 21:35
A shell workspace management library
## A workspace manager
: ${WS_CONFIG_DIR:=~/.config/ws}
ws_l () {
for ws_file in "${WS_CONFIG_DIR}"/*.ws; do
local ws_name="$(basename "$ws_file")"
ws_name="${ws_name%.ws}"
printf "%-10s\t%s\n" "$ws_name" "$(cat "${ws_file}")"
done
@multun
multun / allocation_checker.c
Last active November 9, 2018 18:12
Poor man's embed-ish allocation tracker
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>
// random hash implementation from the internet
#define rot(x, k) (((x) << (k)) | ((x) >> (32 - (k))))
#define mix(a, b, c) \
{ \