Skip to content

Instantly share code, notes, and snippets.

@sturadnidge
sturadnidge / isoboot.ipxe
Created May 13, 2012 17:30
iPXE Boot an ISO
#!ipxe
echo
initrd http://webserver.fqdn/iso/firmware.iso
chain http://webserver.fqdn/memdisk/memdisk iso ||
echo
echo netboot failed, attempting to boot from local disk
echo
sanboot --no-describe --drive 0x80 ||
echo
echo local boot failed, booting ipxe shell
@sturadnidge
sturadnidge / genCert.md
Last active March 21, 2023 09:38
Generate a self signed certificate in 1 line + a config file

To generate a self-signed cert, do the following:

openssl req -config 12factor.req -new -nodes -x509 -newkey rsa:2048 -sha256 -keyout 12factor.key -out 12factor.cert -days 3650

Where 12factor.req is:

[ req ]
default_bits        = 2048
default_keyfile     = 12factor.key
@sturadnidge
sturadnidge / wheezy.preseed
Created June 22, 2013 14:40
Debian 7.x preseed file for a simple, minimal install.
#### Contents of the preconfiguration file (for wheezy)
### Localization
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/keymap select us
d-i keymap select us
### Network configuration
d-i netcfg/choose_interface select auto
### Mirror settings
@sturadnidge
sturadnidge / tmux-1.8-on-CentOS-6.x.txt
Last active May 10, 2021 18:31
Install tmux 1.8 on CentOS 6.x minimal (64bit)
# download latest libevent2 and tmux sources, and extract them somewhere
# (thx bluejedi for tip on latest tmux URL)
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://sourceforge.net/projects/tmux/files/latest/download?source=files
#
# install deps
yum install gcc kernel-devel make ncurses-devel
@sturadnidge
sturadnidge / steamGetFloatValue.js
Created January 1, 2016 17:28
Gets the float value of a Steam inventory item
'use strict';
/*jshint node:true */
// npm install lodash colors minimist request sync-request
var _ = require('lodash'),
colours = require('colors/safe'),
parseArgs = require('minimist'),
request = require('request'),
requestSync = require('sync-request'),
@sturadnidge
sturadnidge / debian.ipxe
Created June 22, 2013 14:43
ipxe boot script - despite several of these parameters being in the preseed.cfg file, they don't work unless you pass them in as kernel params. Not sure if that is a documentation bug or an actual bug.
#!ipxe
echo
echo attempting to netboot with IP ${ip}
echo
set buildserver your.build.server.fqdn
set pxebase http://${buildserver}/path/to/bootfiles/dir
kernel ${pxebase}/linux preseed/url=http://${buildserver}/${uuid}/preseed.cfg debian-installer/locale=en_US.UTF-
8 keymap=us netcfg/get_hostname=${uuid} netcfg/get_domain=${domain} --
initrd ${pxebase}/initrd.gz
boot ||
@sturadnidge
sturadnidge / netlogon-to-srv-host
Last active July 17, 2020 04:15
awk one liner to convert netlogon.dns to dnsmasq srv-host format
# if the 4th field is 'SRV', then strip trailing dots, set the output field separator to comma and print accordingly
awk '$4 ~ /SRV/ {gsub(/\.( |$)/, " "); OFS = ","; print "srv-host=" $1,$8,$7,$5,$6}' netlogon.dns
@sturadnidge
sturadnidge / pirewall.sh
Last active November 27, 2018 08:59
Script to setup a basic ruleset for iptables, used on my raspberrypi firewall.
#!/bin/sh
# * eth0 = Internet interface (DHCP)
# * eth1 = LAN interface (192.168.1.0/24)
# * eth2 = DMZ interface (172.16.0.0/16)
# * Traffic open from firewall to internet
# * Traffic open and translated from LAN and DMZ to internet
# * Traffic open from LAN to Firewall
# * Traffic open from LAN to DMZ
# * Traffic open from internet to a DMZ web server
@sturadnidge
sturadnidge / rootCA.cfg
Created July 14, 2017 01:40
openssl config file for a root CA that will sign requests with subjectAltName(s)
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
@sturadnidge
sturadnidge / tcp-server.js
Last active January 7, 2018 01:22
node.js tcp server
var net = require('net');
var server = net.createServer(function(socket) {
socket.write('ADMIN HE DOING IT SIDEWAYS\r\n');
socket.pipe(socket);
});
server.listen(process.env.PORT);