Skip to content

Instantly share code, notes, and snippets.

#!/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' $!";
@bahamat
bahamat / nginx_log_format_bunyan.conf
Last active September 14, 2016 08:12
nginx log_format bunyan
log_format bunyan '{'
'"name": "nginx/$nginx_version",'
'"hostname": "$hostname",'
'"pid": "$pid",'
'"level": 30,'
'"time": "$time_iso8601",'
'"v": 0,'
'"msg": "access",'
'"remoteAddress": "$remote_addr",'
@bmhatfield
bmhatfield / .profile
Last active January 29, 2025 11:11
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
| From: "Roger A. Faulkner" <Roger.Faulkner@Eng>
| Subject: Re: curiosity: truss?
| Date: Wed, 27 Jan 1999 23:34:47 -0800 (PST)
|
| For your edification, this is the geneaology of the name "truss"
| (taken from some mail dated Sep 26, 1988)
| This was when Ron Gomes and I were jointly developing the first
| /proc for SVR4 at USL.
| -----------------------------------------------------------------
|
@dgwynne
dgwynne / bunyan.lua
Created July 12, 2016 05:08
lua bunyan
local logfile = require("logfile")
local P = require("posix")
local cjson = require("cjson")
local cookies = require("http_cookies")
local _M = {
fatal = 60,
error = 50,
warn = 40,
@jperkin
jperkin / smartos-pppoe-router.md
Last active September 8, 2024 13:06
SmartOS PPPoE Router (AAISP, v6, DNS/DHCP)

Intro

This documents my setup of a SmartOS server as my PPPoE router, providing DNS/DHCP services to the local network.

Basic setup:

  • DSL modem (VMG1312) in bridge mode handling the DSL connection
  • 192.168.1.0/24 local network
  • 192.168.1.5 will be the IP address of the router zone
  • e1000g0 is the configured internal 'admin' interface
@rezan
rezan / self_route.vcl
Last active February 28, 2024 12:56
Self routing Varnish Cache cluster example
# Self routing cluster example
vcl 4.0;
import directors;
backend node1 {
.host = "node1.example.com";
.port = "80";
}

Setting up netboot.xyz with an EdgeRouter

This document covers how to setup netboot.xyz, a service that provides iPXE-based installation and live boot of a bunch of operating systems, on a Ubiquiti EdgeRouter.

Assumptions

I've made a few assumptions throughout this document that will probably be different for your setup:

@mgerdts
mgerdts / README.md
Created October 18, 2019 11:56
Triton on Linux KVM

Triton on Linux KVM

I have a beefy Linux box that I use for development. One of the things this box does is run KVM instances that run a Triton headnode and several compute nodes.

Configuration

Networking

I have a single gigabit link to the outside world. All networks are able to reach the outside world via NAT.

@oetiker
oetiker / make-bootable-image.sh
Last active June 19, 2024 06:58
How to create a bootable disk image that works with bios and uefi
#!/bin/sh
# apt install gdisk syslinux syslinux-efi mtools
IMG=boot-image.img
SIZE=300
KERNEL=vmlinz
INITRAMFS=initrd.img
MD="mmd -i ${IMG}@@1M"
CP="mcopy -i ${IMG}@@1M"
RN="mren -i ${IMG}@@1M"
dd if=/dev/zero bs=1M count=$SIZE of=$IMG