Skip to content

Instantly share code, notes, and snippets.

niamtokik

Block or report user

Report or block niamtokik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@niamtokik
niamtokik / setup.sh
Created Mar 26, 2019 — forked from adamsteen/setup.sh
OpenBSD Current: MirageOS
View setup.sh
#!/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 / socatd.sh
Created Jul 18, 2018
FreeBSD socatd service
View socatd.sh
#!/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 / editor2.erl
Last active Feb 14, 2018
Simple File Representation In Erlang/OTP with gen_statem Behavior
View editor2.erl
%%%===================================================================
%%% @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 Feb 8, 2018
Erlang/OTP IRC Client Test
View irc_connection.erl
-module(irc_connection).
-compile(export_all).
-behaviour(gen_statem).
%%====================================================================
%%
%%====================================================================
start() ->
start([]).
start(Args) ->
gen_statem:start(?MODULE, Args, []).
@niamtokik
niamtokik / reauest.erl
Created Feb 8, 2018
erlang process wrapper around common data-structure
View reauest.erl
-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 Jan 9, 2018
Quick and Dirty implementation of ZFS dmu_replay_record from zfs_ioctl.h (PoC)
View dmu_replay_record.erl
%%%-------------------------------------------------------------------
%%% @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).
@niamtokik
niamtokik / Main.hs
Created Dec 19, 2017
Some experiment with System.Posix.Signals in Haskell
View Main.hs
module Main where
import System.Posix
import System.Posix.IO
import System.Posix.Signals
test childRead fatherWrite = do
(r, _) <- fdRead childRead 10
putStrLn r
childHandler = do
@niamtokik
niamtokik / intel.conf
Last active Dec 7, 2017
OpenBSD Xorg Configuration Files for GPD Pocket with wsfb (/etc/X11/xorg.conf.d/)
View intel.conf
Section "Device"
Identifier "Device0"
Driver "intel"
Option "DRI" "3"
EndSection
View libiovec.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/param.h>
#include <stdlib.h>
#include <string.h>
struct tuple {
struct iovec key;
struct iovec value;
@niamtokik
niamtokik / ports.mtree
Created Oct 29, 2017
OpenBSD mtree structure
View ports.mtree
######################################################################
# mtree ports structure
# cd /usr/ports
# mtree ports.mtree
######################################################################
/set type=dir uname=root gname=wheel mode=0755
.
distfiles uname=_pfetch gname=_pfetch
..
You can’t perform that action at this time.