Skip to content

Instantly share code, notes, and snippets.

@nshalman
nshalman / hgrep.c
Last active August 29, 2015 14:01
grep that preserves the header line
/*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
* In jurisdictions that recognize copyright laws, the author or authors
* of this software dedicate any and all copyright interest in the

Manatee Brain Transplant

The goal of this process is to upgrade a manatee of any vintage to Manatee v2. It relies on ZFS send/recv to replicate the data, but is limited to a migration between nodes in ONWM.

step 1. upgrade moray

Upgrading moray to a forward/backward compatible version is a prerequisite of the upgrade. The usual process is to disable one moray node, double-check the stack reconnects correctly, reprovision that node, and then repeat for other moray nodes.

If there is only one moray node deployed, deploying a second using the new image allows you to upgrade the original node as above.

@bdha
bdha / gist:c456cf6e5484ea5ad256
Last active August 29, 2015 14:15
Building Haskell on SmartOS
@bahamas10
bahamas10 / quine.bash
Created March 3, 2015 07:38
bash quine
#!/usr/bin/env bash
s=(
'#!/usr/bin/env bash'
''
's=('
')'
''
'q=$(printf "\x27")'
'for ((i = 0; i < 3; i++ )); do'
@bahamas10
bahamas10 / quine.js
Created March 4, 2015 16:24
node quine
#!/usr/bin/env node
var util = require("util");
var source = [
'#!/usr/bin/env node',
'',
'var util = require("util");',
'',
'var source = [',
#!/usr/sbin/dtrace -C -s
#pragma D option quiet
#pragma D option strsize=4096
#define PTR__SIZE sizeof(uint64_t)
struct SSL {
uint32_t version;
uint8_t pad[0x12c];
@jefftriplett
jefftriplett / filter_through_command.py
Created September 29, 2011 19:39
Sublime Text 2: "Filter Through Command" plugin
# saved from: http://pastie.org/private/bclbdgxzbkb1gs2jfqzehg
import sublime
import sublimeplugin
import subprocess
class RunExternalCommand(sublimeplugin.TextCommand):
"""
Runs an external command with the selected text,
which will then be replaced by the command output.
@benr
benr / gist:5505198
Created May 2, 2013 20:34
SmartOS Vagrant Box, first preview. Lacks VBox Extensions for disk sharing. (smartos-20130419T073558Z)
vagrant box add smartos http://cuddletech.com/tmp/smartos-latest.box
mkdir smartos && cd smartos
vagrant init smartos
vagrant up
vagrant ssh
@AlainODea
AlainODea / install-isc-smf.sh
Last active December 21, 2015 14:39
An SMF manifest for ISC DHCP on SmartOS
#!/bin/bash
curl https://gist.githubusercontent.com/AlainODea/6321603/raw/760ebf43a2f48a78d99b8ca6dbc98a4b84684647/isc-dhcpd-smf.xml > /opt/local/lib/svc/manifest/isc-dhcpd-smf.xml
svccfg import /opt/local/lib/svc/manifest/isc-dhcpd-smf.xml
echo Run 'svcadm enable svc:/pkgsrc/isc-dhcpd:default' to enable ISC DHCP Daemon after configuration
#!/usr/bin/env perl
use File::Basename;
my $WORKDIR=$ENV{PWD};
my $PKGDIR=$WORKDIR . "/chef";
chdir $PKGDIR;
my $file = "pkgmap";
open my $fh, '<', $file or die "Could not open '$file' $!";