Skip to content

Instantly share code, notes, and snippets.

View dch's full-sized avatar
🛋️

Dave Cottlehuber dch

🛋️
View GitHub Profile
@dch
dch / smartctl.log
Last active January 29, 2017 22:40
akai smart status 20170129
smartctl 6.5 2016-05-07 r4318 [FreeBSD 12.0-CURRENT amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Apple SD/SM/TS...E/F SSDs
Device Model: APPLE SSD SM0256G
Serial Number: S2HLNYAH203128
LU WWN Device Id: 5 002538 900000000
Firmware Version: BXW2SA0Q
User Capacity: 251,000,193,024 bytes [251 GB]
@dch
dch / smartctl.md
Created January 29, 2017 22:39
akai smart status 20170129

smartctl 6.5 2016-05-07 r4318 [FreeBSD 12.0-CURRENT amd64] (local build) Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION === Model Family: Apple SD/SM/TS...E/F SSDs Device Model: APPLE SSD SM0256G Serial Number: S2HLNYAH203128 LU WWN Device Id: 5 002538 900000000 Firmware Version: BXW2SA0Q User Capacity: 251,000,193,024 bytes [251 GB]

@dch
dch / instructions.md
Created January 9, 2017 07:57 — forked from johnko/instructions.md
Installing FreeBSD on a USB drive with ZFS using bsdinstall unattended

Installing FreeBSD on a USB drive with ZFS using bsdinstall unattended

I typically wrap all these commands into a shell script that I can reuse, but here they are in steps.

Please read through all the instructions before actually performing the commands, just to avoid any surprises

Requirements:

  • careful typing and copy/paste skills
  • USB drive (8 GB+ ?) Make sure you don't need anything on that drive
@dch
dch / rsyslog.md
Created January 6, 2017 23:15
rsyslog template forwarding tips via "Dan Woodruff <[email protected]>" in "[rsyslog] collect and forward w/o change"

Some things to keep in mind with the queue are:

  • This queue only takes place where you use 'call ForwardToQRadar' as your action for a filter, such as:
if ($msg contains 'Teardown' )
then {
 call ForwardToQRadar
```
sudo zfs create \
-o mountpoint=/Users/dch/Applications \
-o skunkwerks:automount=osx \
-o com.apple.mimic_hfs=on \
-o casesensitivity=insensitive \
-o normalization=formD \
-o com.apple.browse=on \
zroot/shared/Applications
sudo chown -R dch:staff Applications

Packaging

FreeBSD 10+ provides a new pkg(7) tool and a new efficient binary format for storing package info, with similar functionality to apt or yum in Linux distros.

Despite this, building custom packages on FreeBSD is a very simple task and we should use it as much as possible, both to set build -specific options, and to make our own private ports, instead of just relying on upstream packages and changes.

# Options for haproxy-1.6.9
_OPTIONS_READ=haproxy-1.6.9
_FILE_COMPLETE_OPTIONS_LIST=DEVICEATLAS DOCS EXAMPLES LUA OPENSSL DPCRE SPCRE
OPTIONS_FILE_UNSET+=DEVICEATLAS
OPTIONS_FILE_SET+=DOCS
OPTIONS_FILE_SET+=EXAMPLES
OPTIONS_FILE_SET+=LUA
OPTIONS_FILE_SET+=OPENSSL
OPTIONS_FILE_UNSET+=DPCRE
OPTIONS_FILE_SET+=SPCRE
@dch
dch / config.ex
Created October 17, 2016 11:26 — forked from bitwalker/config.ex
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.
#!/usr/bin/env escript
%%% This script converts an arbitrary binary file to an Erlang module with a
%%% single exported 'bin/0' function that returns the original binary.
%%%
%%% See the end of the file for how I figured out the correct terms.
main(["+debug_info" | Files]) ->
io:format("Embedding binaries with debug_info...\n"),
lists:foreach(fun(X) -> embed_file_in_beam(X, [debug_info]) end, Files);