Skip to content

Instantly share code, notes, and snippets.

View niamtokik's full-sized avatar

Niamtokik niamtokik

View GitHub Profile
@niamtokik
niamtokik / Makefile
Created November 26, 2023 13:19
OpenBSD Sync Repository Makefile
######################################################################
# A simple Makefile to synchronize OpenBSD repository locally. Helpful
# for air-gapped computers.
#
# $ make help
# $ make all
#
# see: https://www.openbsd.org/ftp.html#rsync
######################################################################
VERSION ?= 7.4
@niamtokik
niamtokik / Makefile
Last active March 1, 2022 12:56
Meetup BSD Rennes - Jail Makefile
######################################################################
# BSD Meetup Rennes - FreeBSD Jails Workshop
#
# TEA-WARE LICENSE:
# Mathieu Kerjouan <contact@steepath.eu> wrote this file. As long as
# you retain this notice you can do whatever you want with this
# stuff. If we meet some day, and you think this stuff is worth it,
# you can buy me a tea in return. Mathieu Kerjouan
#
######################################################################
@niamtokik
niamtokik / socatd.sh
Created July 18, 2018 16:31
FreeBSD socatd service
#!/usr/bin/env sh
######################################################################
# socat daemon wrapper. This script use daemon(8) command and
# transform a standard socat process in daemon. This script stop
# the service by stopping daemon supervisor instead of socat process.
#
# PROVIDE: socatd
# REQUIRE: network
# KEYWORD: socat daemon
#
@niamtokik
niamtokik / update.sh
Created January 24, 2017 11:29
simple, quick and dirty netbsd standard cvs update wrapper with mail alert
#!/bin/sh
######################################################################
# simple cvs update wrapper for netbsd #
######################################################################
ALERT_MAIL="yes"
ALERT_USER="root"
CVS_OPTS="-qz3"
CVS="cvs ${CVS_OPTS}"
@niamtokik
niamtokik / intel.conf
Last active March 18, 2021 22:32
OpenBSD Xorg Configuration Files for GPD Pocket with wsfb (/etc/X11/xorg.conf.d/)
Section "Device"
Identifier "Device0"
Driver "intel"
Option "DRI" "3"
EndSection
@niamtokik
niamtokik / setup.sh
Created March 26, 2019 07:35 — forked from adamsteen/setup.sh
OpenBSD Current: MirageOS
#!/bin/sh -e
# required packages
doas pkg_add ocaml opam
# setup opam and mirage
opam init
eval $(opam env)
# pins to fix for OpenBSD Current (mincore fixes and noretpoline)
@niamtokik
niamtokik / editor2.erl
Last active February 14, 2018 19:01
Simple File Representation In Erlang/OTP with gen_statem Behavior
%%%===================================================================
%%% @doc Editor2 State Machine simulate a file with different action
%%% on it (append, delete, read).
%%% @end
%%% @todo add something to abstract state data-structure.
%%% @todo add dynamic callback functions (editor_test currently).
%%% @todo add replace function support.
%%% @todo add map function support.
%%%===================================================================
-module(editor2).
@niamtokik
niamtokik / irc_connection.erl
Created February 8, 2018 06:45
Erlang/OTP IRC Client Test
-module(irc_connection).
-compile(export_all).
-behaviour(gen_statem).
%%====================================================================
%%
%%====================================================================
start() ->
start([]).
start(Args) ->
gen_statem:start(?MODULE, Args, []).
@niamtokik
niamtokik / reauest.erl
Created February 8, 2018 06:34
erlang process wrapper around common data-structure
-module(request).
-behaviour(gen_server).
%% API exports
-export([]).
-compile(export_all).
-record(state, { type, struct, name, options }).
start() ->
@niamtokik
niamtokik / dmu_replay_record.erl
Created January 9, 2018 19:47
Quick and Dirty implementation of ZFS dmu_replay_record from zfs_ioctl.h (PoC)
%%%-------------------------------------------------------------------
%%% @author Mathieu Kerjouan
%%% @copyright (c) 2018, Mathieu Kerjouan
%%% @doc This is a quick and dirty zfs dmu replay record implementation
%%% in Erlang. This is only a PoC and should not be used in
%%% production. This code is an implementation of zstreamdump
%%% from OpenZFS.
%%% @end
%%%-------------------------------------------------------------------
-module(dmu_replay_record2).