Skip to content

Instantly share code, notes, and snippets.

View 0xf10e's full-sized avatar
😶
I may be slow to respond.

Florian Ermisch 0xf10e

😶
I may be slow to respond.
View GitHub Profile
@0xf10e
0xf10e / .sh
Created August 3, 2015 17:53
So easy to get all the info you need for a $POOL-$POSITION-$SERIAL label with mfiutil(8) and mfi(4)/mrsas(4)
~% POOL=foobar; sudo mfiutil -u 1 show drives | sed -ne 's/ *\([0-9]*\) (.*serial=\([A-Z0-9]*\)> SCSI-[0-9]* \(E[0-9]*:S[0-9]*\)/ID=\1 SERIAL=\2 POS=\3/p'| while read LINE; do eval "$LINE"; DEV=`dmesg | sed -ne "/deviceid: $ID)/s/\(mfi[^:]*\):.*/\1/p" | tail -n 1`; echo $DEV has serial $SERIAL, located in $POS:; gpart
list $DEV 2> /dev/null | grep label: || ( sudo gpart show $DEV || ( sudo gpart create -s gpt $DEV && sudo gpart add -a 1M -t freebsd-zfs -s 3700GB -l $POOL-`printf %02d "${POS#*S}"`-$SERIAL $DEV) ); done
@0xf10e
0xf10e / no_desktop.sh
Created August 4, 2015 11:54
Remove all the desktop stuff from Ubuntu
#!/bin/sh
# may need additional "xubuntu-*" or the likes for other flavors
apt-get remove $(for PKG in $(dpkg-query \
--showformat='${Essential} ${Status}:${Package} ${Depends} ${Recommends}\n\n' \
--show \*-desktop lubuntu\*| sed -e '/^yes/d' -e '/not-installed/d' -e 's/^[^:]*://' \
-e 's/(\(<<\|>=\).*)//g' -e 's/|//g' -e 's/:any //g' -e s/,//g);
do
dpkg-query --showformat='${Status}: ${Package}\n' --show $PKG | sed -ne 's/^install ok installed://p';

Keybase proof

I hereby claim:

  • I am 0xf10e on github.
  • I am 0xf10e (https://keybase.io/0xf10e) on keybase.
  • I have a public key whose fingerprint is 05F5 79FB 647A 0501 0F0F BA78 3ECE 2CC6 026B 24D6

To claim this, I am signing this object:

@0xf10e
0xf10e / _var_log_messages
Created December 27, 2015 17:52
stack backtrace on `zpool export` since upgrade to 11-CURRENT
Dec 27 18:44:02 fuchi-cyber220 kernel: lock order reversal:
Dec 27 18:44:02 fuchi-cyber220 kernel: 1st 0xfffff800c7472418 zfs (zfs) @ /usr/src/sys/kern/vfs_mount.c:1224
Dec 27 18:44:02 fuchi-cyber220 kernel: 2nd 0xfffff800c73fad50 zfs_gfs (zfs_gfs) @ /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c:494
Dec 27 18:44:02 fuchi-cyber220 kernel: stack backtrace:
Dec 27 18:44:02 fuchi-cyber220 kernel: #0 0xffffffff80a7d6f0 at witness_debugger+0x70
Dec 27 18:44:02 fuchi-cyber220 kernel: #1 0xffffffff80a7d5f1 at witness_checkorder+0xe71
Dec 27 18:44:02 fuchi-cyber220 kernel: #2 0xffffffff809fedcb at __lockmgr_args+0xd3b
Dec 27 18:44:02 fuchi-cyber220 kernel: #3 0xffffffff80ac55ec at vop_stdlock+0x3c
Dec 27 18:44:02 fuchi-cyber220 kernel: #4 0xffffffff80fbb220 at VOP_LOCK1_APV+0x100
Dec 27 18:44:02 fuchi-cyber220 kernel: #5 0xffffffff80ae653a at _vn_lock+0x9a
@0xf10e
0xf10e / gelitest.md
Last active January 23, 2016 14:06 — forked from anonymous/gelitest.md
Draft for a FreeBSD bugreport

Preface

I added a 256GB mSATA SSD to my Lenovo x220 of which I planned to use a nice chunk as L2ARC for the SATA HDD. Even without a SATA disk present the SSD showed up as HDD2 in the BIOS.

Made a fresh installation of FreeBSD 10.2 amd64 with the memstick image and chose ZFS+Geli. Booted, worked, everything just fine. I added a

user@workstation:/srv/salt/formulas/openstack-formula.git% cat /srv/salt/base.hg/test.sls
pillarkey_to_check:
test.check_pillar:
- string: 'nova:database:password'
user@workstation:/srv/salt/formulas/openstack-formula.git% sudo salt con\* state.sls test
controller:
----------
ID: pillarkey_to_check
Function: test.check_pillar
Result: True
@0xf10e
0xf10e / babilen_asked_for_it.log
Created January 28, 2016 11:47
using pillar.get in state files broken in 2015.8 on Ubuntu?
user@workstation:/srv/salt/formulas/openstack-formula.git% sudo salt controller pillar.get 'openstack:skip_pillar_check'
controller:
True
user@workstation:/srv/salt/formulas/openstack-formula.git% head nova/nova_conf.sls
{% from 'openstack/defaults.jinja' import openstack_defaults %}
{% from 'nova/map.jinja' import nova with context %}
{% if not pillar.get('openstack:skip_pillar_check', False) %}
nova passwords in pillar:
test.check_pillar:
- failhard: True
@0xf10e
0xf10e / example.md
Created September 13, 2017 07:21
HPR 2378 - lists and code blocks
  1. ok,
  2. let's
  3. see: foo, four spaces in as $HOST said doesn't work
  4. but
  5. what about three backticks?

echo $HPR

1. didn't work?
@0xf10e
0xf10e / updates.sh
Created February 21, 2018 07:33
Update command from my shell history
sudo pkg upgrade && sudo portsnap fetch update && \
( pkg version | grep -v =; pkg audit ); \
NUM_SNAPS=`zfs list -rt snapshot | wc -l`; \
sudo zfSnap -d -p cron_; sudo -K; \
NUM_SNAPS_NEW=`zfs list -rt snapshot | wc -l`; \
printf "\n%8d ZFS snapshots across all pools \n%8d Snapshots deleted in last purge\n" \
$NUM_SNAPS_NEW $(( $NUM_SNAPS - $NUM_SNAPS_NEW ))
@0xf10e
0xf10e / 00_clean_src.sh
Last active February 21, 2018 07:41
Used on my 11^W12-CURRENT laptop to rebuild FreeBSD from source.
#!/bin/sh
UPDATE_SRC=false
if [ ! -z "$1" ] && [ "$1" = "-u" ];
then
UPDATE_SRC=true
if which svn; then
SVN=`which svn`
elif which svnlite; then
SVN=`which svnlite`