Skip to content

Instantly share code, notes, and snippets.

@j-c-m
j-c-m / mikrotik-wan-queue-wireguard.rsc
Last active August 30, 2024 21:20
Mikrotik WAN queue including Wireguard Traffic.
# disable fastttrack
/ip/firewall/filter/disable [find action="fasttrack-connection"]
# mark WAN packets
/ip firewall mangle
add action=mark-packet chain=prerouting comment="wan-download mark" \
in-interface-list=WAN new-packet-mark=wan-download passthrough=yes
add action=mark-packet chain=postrouting comment="wan-upload mark" \
new-packet-mark=wan-upload out-interface-list=WAN passthrough=yes
@j-c-m
j-c-m / smb4.conf
Last active November 21, 2022 20:45
Make samba fast (usable) for OS X
[global]
vfs objects = fruit catia streams_xattr
fruit:aapl = yes
fruit:encoding = native
fruit:locking = none
fruit:metadata = stream
fruit:resource = file
[per share]
veto files = /icon?/TheVolumeSettingsFolder/.DS_Store/.TemporaryItems/TheFindByContentFolder/.FBCindex/.FBCIndexCopy/.localized/Network Trash Folder/Temporary Items/Cleanup At Startup/.FBCLockFolder/.Trashes/._*
@j-c-m
j-c-m / Managing instances within SMF.txt
Created January 11, 2019 02:15
Managing instances within SMF
Managing instances within SMF
SMF is a great Solaris 10 feature, however it lacks some truly useful functionality. Imagine that you need to manage multiple instances of one service with different options or context (for example multiple Oracle instances or bunch of tomcats). How will you create this instances? Modify manifest and re-import it? Simply create legacy script for each instance? Here is the way for creating instances on the fly.
UPDATE: Tomcat smf manifest and method can be obtained from here
Create instance of service svc:/network/tomcat named devel:
# svccfg -s svc:/network/tomcat add devel
@j-c-m
j-c-m / gpxe OpenBSD install
Last active October 28, 2018 19:59 — forked from jnbek/gpxe OpenBSD install
Booting/Installing OpenBSD from gPXE
go into gPXE and
dhcp net0
kernel -n img http://boot.netboot.xyz/memdisk iso
initrd -n img http://ftp.usa.openbsd.org/pub/OpenBSD/6.4/amd64/cd64.iso
boot img
@j-c-m
j-c-m / install-ripgrep.sh
Last active February 17, 2018 21:36
install-ripgrep.sh
#!/bin/bash
TMPDIR=$(mktemp -d)
ARCH=$(uname -p)
cd $TMPDIR && curl -s https://api.github.com/repos/BurntSushi/ripgrep/releases/latest \
| grep "browser_download_url.*$ARCH-unknown-linux" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
@j-c-m
j-c-m / patch-source3__lib__sendfile.c
Last active January 30, 2017 23:13
/usr/ports/net/samba44/files/patch-source3__lib__sendfile.c # comment out aio directives, use sendfile = yes
diff --git source3/lib/sendfile.c source3/lib/sendfile.c
index 3d457bd6f13..f2b18b511cb 100644
--- source3/lib/sendfile.c
+++ source3/lib/sendfile.c
@@ -25,64 +25,122 @@
#include "includes.h"
+#if defined(FREEBSD_SENDFILE_API) || defined(DARWIN_SENDFILE_API) || defined(LINUX_SENDFILE_API)
+

Recently I migrated a few ZFS storage pools from FreeBSD to SmartOS. I found many potentially dangerous methods outlined on the web, when in fact migrating ZFS storage pools is quite easy.

The trick is you must utilize zpool import -d <dir> combined with symbolic links to the correct devices.

I am including an example below of migration between FreeBSD and SmartOS

  • Pool status and export from the FreeBSD system.
root@freebsd:~ # zpool status
@j-c-m
j-c-m / nginx_php_location_block
Created March 29, 2014 17:55
Nginx PHP-FPM location block
location ~ \.php(/.*)?$ {
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_buffers 32 4k;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
}