Skip to content

Instantly share code, notes, and snippets.

@timkuijsten
timkuijsten / smartos.vbox.md
Last active October 2, 2020 10:55
SmartOS on VirtualBox

VirtualBox config

vbox host vboxnet0 = 192.168.56.1 (static, no dhcp)

vbox smartos guest config:

storage:

  • add ISO

audio:

  • disable
<?php
/*
* Copyright (c) 2017 Tim Kuijsten
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
@timkuijsten
timkuijsten / udptun.c
Created July 12, 2018 19:42
unencrypted udp based vpn tunnel
/* A simple unencrypted UDP tunnel between two tunnel devices. */
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <net/route.h>
#include <net/if.h>
#include <net/if_tun.h>
#include <netinet6/in6_var.h>
@timkuijsten
timkuijsten / bin2hex.c
Last active December 28, 2019 00:14
binary to hexadecimal
#include <stddef.h>
/*
* Encode binary data into ASCII hexadecimal numbers.
*
* Return the number of hexadecimals written in "out". If "outlen" is at least
* twice as long as "inlen" the result is not truncated.
*/
size_t
bin2hex(char *out, size_t outlen, const unsigned char *in, size_t inlen)