Skip to content

Instantly share code, notes, and snippets.

@wiedi
wiedi / touchbarctl
Created Jul 22, 2021
Disable Mac OSX touchbar
View touchbarctl
#!/bin/bash
#set -x
if [ $# -ne 1 ]; then
echo "Usage:"
echo -e "\t${0} [on|off]"
echo
echo "Be sure to disable SIP:"
echo " - Reboot"
echo " - Hold cmd+R until apple logo shows up"
echo " - Open Terminal and run 'csrutil disable'"
View pkgsrc-milti.md

unprivileged pkgsrc multi envs

First time

mkdir -p ~/.pkg

Create New Env

View vminfod-silence.sh
sed "s_level: 'debug'_level: 'error'_" /usr/vm/sbin/vminfod > /var/tmp/vminfod
chmod +x /var/tmp/vminfod
mount -F lofs /var/tmp/vminfod /usr/vm/sbin/vminfod
svcadm restart vminfod
View gist:1dc90b900e94da18d861433c39d97875
vmadm stop -f <kvm-uuid>
...
2018-11-05T10:23:18.033300+00:00 beans genunix: [ID 408114 kern.info] /pseudo/zconsnex@1/zcons@13 (zcons13) online
2018-11-05T10:24:08.469553+00:00 beans mac: [ID 469746 kern.info] NOTICE: vnic1185 registered
2018-11-05T10:24:08.698796+00:00 beans kvm: [ID 420667 kern.info] kvm_lapic_reset: vcpu=ffffff989cdac000, id=0, base_msr= fee00100 PRIx64 base_address=fee00000
2018-11-05T10:24:08.698824+00:00 beans kvm: [ID 710719 kern.info] vmcs revision_id = e
2018-11-05T10:24:27.872568+00:00 beans kvm: [ID 391722 kern.info] unhandled wrmsr: 0x1010101 data fffffd7fffdfe8a0
2018-11-05T10:24:27.880654+00:00 beans kvm: [ID 391722 kern.info] unhandled wrmsr: 0xff300cec data fffffd7fffdfe870
View pillow_exif_rotate.py
from PIL import Image, ExifTags
def exif_rotate(img):
exif_tags = dict([(x[1], x[0]) for x in ExifTags.TAGS.items()])
orientation = 1
try:
orientation = img._getexif()[exif_tags['Orientation']]
except:
View smartos-lx-priocntl.md

priocntl inside SmartOS LX-Zone

Needs proc_priocntl privilege:

vmadm update 874520a9-708e-41d8-86a8-f46c7a8cdf28 limit_priv=default,proc_priocntl

Inside needs two symlinks:

ln -s /native/usr/bin/priocntl /usr/bin/
ln -s /native/usr/lib/class /usr/lib/class
View gist:546912433c4adae234ff3997cc6d9980
18:39:51.056739 ARP, Request who-has 91.65.191.142 tell 91.65.191.254, length 46
18:39:51.077447 ARP, Request who-has 91.65.191.155 tell 91.65.191.254, length 46
18:39:51.078474 ARP, Request who-has 91.65.191.147 tell 91.65.191.254, length 46
18:39:51.079473 ARP, Request who-has 91.65.191.157 tell 91.65.191.254, length 46
18:39:51.079746 ARP, Request who-has 91.65.191.149 tell 91.65.191.254, length 46
18:39:51.080473 ARP, Request who-has 91.65.191.158 tell 91.65.191.254, length 46
18:39:51.081798 ARP, Request who-has 91.65.191.156 tell 91.65.191.254, length 46
18:39:51.090300 ARP, Request who-has 91.65.191.181 tell 91.65.191.254, length 46
18:39:51.094502 ARP, Request who-has 91.65.191.193 tell 91.65.191.254, length 46
18:39:51.098456 ARP, Request who-has 91.65.191.200 tell 91.65.191.254, length 46
View free.diff
From 604c6e890ca495364fc5b5cce2861ce1f0c2d3e3 Mon Sep 17 00:00:00 2001
From: Sebastian Wiedenroth <sebastian.wiedenroth@skylime.net>
Date: Thu, 22 Jun 2017 15:37:42 +0200
Subject: [PATCH] 5838 a Linux-like free(1M) would probably not be a bad thing
---
usr/src/cmd/Makefile | 1 +
usr/src/cmd/free/Makefile | 33 +++++
usr/src/cmd/free/free.c | 255 ++++++++++++++++++++++++++++++++++
usr/src/man/man1/Makefile | 1 +
View gist:ba7389eca25286d69388a09aacc33bef
Thread 2 Crashed:: Dispatch queue: CA::CG::Queue
0 libobjc.A.dylib 0x00007fff97a504dd objc_msgSend + 29
1 com.apple.driver.AppleIntelHD5000GraphicsMTLDriver 0x0000000110436002 -[MTLIGAccelCommandQueue initWithDevice:maxCommandBufferCount:] + 154
2 com.apple.QuartzCore 0x00007fff86334e58 CA::OGL::MetalContext::MetalContext(void*, CA::OGL::MetalContext*, int) + 224
3 com.apple.QuartzCore 0x00007fff8622410a CA::CG::IOSurfaceRenderer::acquire(CA::CG::IOSurfaceDrawable&, CA::CG::IOSurfaceRenderer**, unsigned int, bool) + 732
4 com.apple.QuartzCore 0x00007fff86223d1c CA::CG::Queue::render_callback(void*) + 52
5 libdispatch.dylib 0x00007fff8729940b _dispatch_client_callout + 8
6 libdispatch.dylib 0x00007fff8729e03b _dispatch_queue_drain + 754
7 libdispatch.dylib 0x00007fff872a4707 _dispatch_queue_invoke + 549
8 libdispatch.dylib 0x00007fff8729940b _dispatch_client_callout + 8
View b2sum.diff
diff --git a/sysutils/b2sum/DESCR b/sysutils/b2sum/DESCR
new file mode 100644
index 0000000..7d19ef2
--- /dev/null
+++ b/sysutils/b2sum/DESCR
@@ -0,0 +1 @@
+Command line utility to hash files using reference implementation of BLAKE2.
diff --git a/sysutils/b2sum/Makefile b/sysutils/b2sum/Makefile
new file mode 100644
index 0000000..902a0ce