Skip to content

Instantly share code, notes, and snippets.

@Martinfx
Martinfx / README.md
Created February 12, 2022 20:06 — forked from hiway/README.md
Creating a single process FreeBSD (12.1) Jail

How to jail a single process web server on FreeBSD 12.1

You may have found many great resources on how to set up jails on latest FreeBSD, however there is scant information on how to go about creating a barebones jail with nothing but the one process that you want to isolate.

I was curious if I could contain a statically compiled web server that I wrote while learning Rust all by itself in a jail instead of having a full userland.

@Martinfx
Martinfx / linux_fusion360.md
Created December 13, 2020 19:13 — forked from probonopd/linux_fusion360.md
Autodesk Fusion 360 on Linux

Autodesk Fusion 360 on Linux

In the Web Browser

Ubuntu, Fedora, openSUSE, CentOS, SUSE Linux Enterprise, Debian,... users can finally use Autodesk Fusion 360 in the Linux Browser now.

https://myhub.autodesk360.com

On Chromium 55.0.2843.0 I get NET::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED.

@Martinfx
Martinfx / xrandr.sh
Created October 19, 2020 17:39 — forked from debloper/xrandr.sh
Add system unrecognized but monitor supported resolution in X
#!/bin/bash
# First we need to get the modeline string for xrandr
# Luckily, the tool `gtf` will help you calculate it.
# e.g. `gtf <hRes> <vRes> <refreshRate>`:
gtf 1920 1080 60
# In this case, the horizontal resolution is 1920px the
# vertical resolution is 1080px & refresh-rate is 60Hz.
# IMPORTANT: BE SURE THE MONITOR SUPPORTS THE RESOLUTION
@Martinfx
Martinfx / freebsd-java.md
Created September 28, 2020 12:55 — forked from nathggns/freebsd-java.md
Installing java on FreeBSD

Before installing this JRE, you have to install the linux binary compatibility on FreeBSD, you can follow this documentation. Jave requires some information about the proc. You have to mount linprocfs, type:

kldload linprocfs
mount -t linprocfs linprocfs /compat/linux/proc

and add this line to /etc/fstab:

linprocfs   /compat/linux/proc   linprocfs   rw   0  0
@Martinfx
Martinfx / list.c
Created March 28, 2020 21:29
Naive thread-safe linked list implementation
#include <stdlib.h>
#include "list.h"
/* Naive linked list implementation */
list *
list_create()
{
list *l = (list *) malloc(sizeof(list));
l->count = 0;
@Martinfx
Martinfx / FreeBSD_mount_img_files.md
Created January 25, 2020 19:24 — forked from yzgyyang/FreeBSD_mount_img_files.md
FreeBSD mount img files

Determine the file system by using the file-utility.

file image.img

Use mdconfig to link the IMG image to a virtual device.

mdconfig -a -t vnode -f /path/to/image.img -u 0
@Martinfx
Martinfx / WhatIsStrictAliasingAndWhyDoWeCare.md
Created September 23, 2019 16:59 — forked from shafik/WhatIsStrictAliasingAndWhyDoWeCare.md
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@Martinfx
Martinfx / xhyve-freebsd-tutorial-1.md
Created August 17, 2019 16:16 — forked from tanb/xhyve-freebsd-tutorial-1.md
FreeBSD running on xhyve tutorial. (Appendix: Resize image with qemu. Create FreeBSD VM with qemu).

TL;DR

  • Create 5GB FreeBSD image.
  • Install FreeBSD on xhyve.
  • Mount host directory.

Requisites

@Martinfx
Martinfx / README.md
Created August 7, 2019 22:34 — forked from bijanebrahimi/README.md
A guide to dtrace in FreeBSD

An introduction

what's dtrace?

DTrace dynamic tracing compiler and tracing utility DTrace is a comprehensive dynamic tracing framework for the Solaris Operating System. DTrace provides a powerful infrastructure that permits administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs.

How to enable dtrace?