Skip to content

Instantly share code, notes, and snippets.

View robinsmidsrod's full-sized avatar

Robin Smidsrød robinsmidsrod

View GitHub Profile
@eqhmcow
eqhmcow / hfsc-shape.sh
Last active August 2, 2023 11:59
HFSC - linux traffic shaping's best kept secret
#!/bin/bash
# As the "bufferbloat" folks have recently re-discovered and/or more widely
# publicized, congestion avoidance algorithms (such as those found in TCP) do
# a great job of allowing network endpoints to negotiate transfer rates that
# maximize a link's bandwidth usage without unduly penalizing any particular
# stream. This allows bulk transfer streams to use the maximum available
# bandwidth without affecting the latency of non-bulk (e.g. interactive)
# streams.
@bradoaks
bradoaks / hfsc-shape.sh
Created April 25, 2011 14:51 — forked from eqhmcow/hfsc-shape.sh
HFSC - linux traffic shaping's best kept secret
#!/bin/bash
# As the "bufferbloat" folks have recently re-discovered and/or more widely
# publicized, congestion avoidance algorithms (such as those found in TCP) do
# a great job of allowing network endpoints to negotiate transfer rates that
# maximize a link's bandwidth usage without unduly penalizing any particular
# stream. This allows bulk transfer streams to use the maximum available
# bandwidth without affecting the latency of non-bulk (e.g. interactive)
# streams.
@robinsmidsrod
robinsmidsrod / gist:948098
Created April 29, 2011 09:22
Booting PXELinux from another location than original TFTP/DHCP-specified location
#!ipxe
echo
echo Booting SystemRescueCD 2.1.0 x86 for ${hostname}
# PXELinux options, see http://syslinux.zytor.com/wiki/index.php/PXELINUX for details
set 210:string http://boot.smidsrod.lan/sysrcd-2.1.0-x86/
set 209:string isolinux.cfg
set filename ${210:string}pxelinux.0
chain ${filename} ||
echo Booting ${filename} failed, dropping to shell
shell
@schwern
schwern / .gitconfig
Created May 25, 2011 22:02
My git aliases
[alias]
st = status
ci = commit -v
cii = commit -v --interactive
cia = commit -v -a
addi = add --interactive
addchanged = add -u
br = branch
co = checkout
diffwords = diff --word-diff
@afair
afair / parse_hstore.pl
Created August 2, 2011 17:58
Perl methods to parse and create PostgreSQL hstore column data
##----------------------------------------------------------------
## HSTORE: PostgreSQL key-value store column type
##----------------------------------------------------------------
# Double-quotes the value, escaping embedded double-quotes. This is NOT the
# same as db quoting (which uses apostrophes), and any value here must also
# be quote()'ed before sending to the database.
sub double_quote {
my ($self, $v) = @_;
$v =~ s/"/\\"/g;
@briandfoy
briandfoy / gist:1342877
Created November 6, 2011 13:29
Perl regex escapes by version of their introduction
# compiled by Tom Christiansen
v1.0 \0, \0N,\0NN Match octal character up to octal 077.
v1.0 \N, \NN, \NNN Match Nth capture group (decimal) if not in charclass and that many seen, else (octal) character up to octal 377.
v4.0 \a Match the alert character (ALERT, BEL).
v5.0 \A True at the beginning of a string only, not in charclass.
v1.0 \b Match the backspace char (BACKSPACE, BS) in charclass only.
v1.0 \b True at Unicode word boundary, outside of charclass only.
v1.0 \B True when not at Unicode word boundary, not in charclass.
v4.0 \cX Match ASCII control character Control-X (\cZ, \c[, \c?, etc).
v5.6 \C Match one byte (C char) even in UTF‑8 (dangerous!), not in charclass.
@wki
wki / css_parser.pl
Created December 22, 2011 19:48
Sample CSS Parser using Marpa::XS
use strict;
use warnings;
use feature ':5.10';
use Marpa::XS;
use Data::Dumper;
#
# a simple CSS snippet for testing
#
my $text = q{
@rubic
rubic / salt-minion.conf
Created January 15, 2012 20:17
Upstart configuration file for salt-minion
# salt-minion.conf
description "salt-minion upstart daemon"
author "Jeff Bauer <jbauer@rubic.com>"
# copy this file to /etc/init
start on (net-device-up and local-filesystems)
stop on shutdown
expect fork
@rubic
rubic / gist:1657182
Created January 22, 2012 14:11
Installing salt with apt-get and pip
apt-get -y install python-pip python-dev python-setuptools git-core
apt-get -y install libzmq1 libzmq-dev python-m2crypto
pip install PyYAML pycrypto pyzmq msgpack-python salt
@robinsmidsrod
robinsmidsrod / _INSTALL.md
Last active March 21, 2024 23:00
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup