Skip to content

Instantly share code, notes, and snippets.

@wiedi
wiedi / gist:fb09a0317e0db2caee6a
Created June 10, 2014 08:49
handlebars helper to iterate by sorted object keys
Handlebars.registerHelper('eachSorted', function(context, options) {
var ret = ""
Object.keys(context).sort().forEach(function(key) {
ret = ret + options.fn({key: key, value: context[key]})
})
return ret
})
@wiedi
wiedi / gist:e4dd12ed084193a3f76f
Last active November 18, 2021 22:11
quick copy paste guide to pkgsrc build zone

build zone

a copy paste guide to pkgsrc building.

make sure your zone has a delegate_dataset

pkgin install -y build-essential nano pkgdiff url2pkg
echo "export EDITOR=nano" >> ~/.profile
@wiedi
wiedi / touchbarctl
Created July 22, 2021 17:29
Disable Mac OSX touchbar
#!/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'"

unprivileged pkgsrc multi envs

First time

mkdir -p ~/.pkg

Create New Env

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
core.spamd.23758
libperl.so`Perl_leave_scope+0x1f8()
libperl.so`Perl_call_sv+0x2d3()
libperl.so`Perl_sighandler+0x21b()
libc.so.1`__sighndlr+6()
libc.so.1`call_user_handler+0x1db(e, 0, fffffd7fffdff150)
libc.so.1`sigacthandler+0x10e(e, 0, fffffd7fffdff150)
libc.so.1`memcpy+0x196f()
libperl.so`Perl_safesysrealloc+0x18()
libperl.so`Perl_savestack_grow_cnt+0x3e()
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
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:

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
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