Skip to content

Instantly share code, notes, and snippets.

/*-
* Copyright (c) 2012 Alfred Perlstein <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@splbio
splbio / gist:4570063
Last active December 11, 2015 07:58
Add code to watchdog to time the watchdog command program, carp when the program takes too long.
The purpose of this is to allow system integrators to tune their watchdogs and
get advanced notice if they are behaving poorly.
The following facilities are added:
- Warn if the watchdog program takes too long.
- Disable activation of the system watchdog so that one can test the watchdogd script
without potentially rebooting the system.
Example:
@splbio
splbio / svn-keywords.diff
Created February 1, 2013 16:13
Patch for keyword expansion against subversion pre-1.8
Index: subversion/include/private/svn_subst_private.h
===================================================================
--- subversion/include/private/svn_subst_private.h (revision 0)
+++ subversion/include/private/svn_subst_private.h (working copy)
@@ -0,0 +1,68 @@
+/**
+ * @copyright
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
@splbio
splbio / gist:4759234
Created February 12, 2013 01:19
watchdog patch
Index: dev/watchdog/watchdog.c
===================================================================
--- dev/watchdog/watchdog.c (revision 246559)
+++ dev/watchdog/watchdog.c (working copy)
@@ -1,5 +1,8 @@
/*-
* Copyright (c) 2004 Poul-Henning Kamp
+ * Copyright (c) 2013 iXsystems.com,
+ * author: Alfred Perlstein <[email protected]>
+ *
@splbio
splbio / gist:5095049
Created March 5, 2013 22:45
lame arena allocator for libz during kernel crashes. allows memory allocation from a hunk of DATA and does minimal "best fit" management of a freelist. This is quick and dirty because the system is about to go down anyhow so any complexity is likely to be wasted time here.
#include <stdio.h>
#include <stddef.h>
#include <sys/types.h>
#include <sys/queue.h>
#ifndef roundup
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)
#endif
/*
Running migrations for account:
- Migrating forwards to 0018_add_hast_user_and_group.
> account:0001_initial
> account:0002_auto__add_bsdusers__add_bsdgroups
> account:0003_auto__add_bsdgroupmembership__del_field_bsdusers_bsdusr_password__add_
> account:0004_builtin_user_and_groups
- Migration 'account:0004_builtin_user_and_groups' is marked for no-dry-run.
Installed 29 object(s) from 1 fixture(s)
> account:0005_auto__add_unique_bsdgroups_bsdgrp_group
> account:0006_add_dbus_users
@splbio
splbio / radio.diff
Created April 17, 2014 06:42
radio killed the port star
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index c56f7e0..120957f 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -5911,17 +5911,34 @@ OPTIONS_WRONG_SINGLE+= ${single}
.endfor
.undef single
+#
+# Iterate through each OPTIONS_RADIO
@splbio
splbio / gist:11020055
Created April 18, 2014 01:17
Fix for pkg+freebsd10-stable
diff --git a/nanobsd/common b/nanobsd/common
index dc7c0a4..f7da3d4 100644
--- a/nanobsd/common
+++ b/nanobsd/common
@@ -291,7 +291,11 @@ do_add_pkg ()
mount -t nullfs -o noatime ${NANO_OBJ}/ports/packages \
${NANO_WORLDDIR}/usr/ports/packages
- CR "cd /usr/ports/packages/All;env SIGNATURE_TYPE=none pkg add -f $1.txz && touch $1.txz.added "
+ local delete_it=true
# get the dif based on a pull request.
# first get the merge info
% git log --format="%p" -1 refs/pull/1/merge
395a6b6 c07adb2
# find the common parent
% git merge-base 395a6b6 c07adb2
7a6ad5e1339681dda3ba55722307143b09685038
# now get the diff for the entire thing.
% git diff 7a6ad5e1339681dda3ba55722307143b09685038..c07adb2
#!/bin/sh
# Make freebsd vm
# fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/10.1-RELEASE/amd64/Latest/FreeBSD-10.1-RELEASE-amd64.raw.xz
VM="FreeBSD10"
RAW_IMG="$1"
BASE_IMG="${RAW_IMG%.raw}"
VMDK_IMG="${BASE_IMG}.vmdk"