Skip to content

Instantly share code, notes, and snippets.

View robinsmidsrod's full-sized avatar

Robin Smidsrød robinsmidsrod

View GitHub Profile
@robinsmidsrod
robinsmidsrod / inventory.ipxe
Created July 16, 2015 22:48
iPXE hardware inventory script (from svenx)
# Run a PCI/SMBios/net inventory scan and upload the results. This gives us a
# way of tracking nodes to some extent, leaving us less blind than usual.
#
# We use the iPXE pciscan command to enumerate the PCI bus. For each device, we
# check the 'header type' register at offset 0x0e. If it's type 0 (endpoint),
# we can read the subsystem vendor and device registers too. Unfortunately, if
# the 7th bit of the header type field is set (0x80), it indicates a
# multi-function device. So to check the type, this bit should be masked out.
# Masking is not possible with iPXE commands, so we have to duplicate some of
# the iseq tests.
@gayanvirajith
gayanvirajith / clear-cache.sh
Created May 19, 2015 05:26
Ez publish 5 clear cache shell script
#!/bin/bash
# Clear production and dev cache of symfony
php ezpublish/console cache:clear --env=prod; php ezpublish/console cache:clear
# Change directory to ezpublish_legacy and clear the legacy cache
cd ezpublish_legacy; php bin/php/ezcache.php --clear-all --purge;
# Change the directory back
cd ..
@robinsmidsrod
robinsmidsrod / pci_inventory_busdevfn.ipxe
Last active December 15, 2015 02:02
iPXE script which makes an inventory of all PCI devices and ship it off using HTTP POST
#!ipxe
params
:pciscan pciscan addr || goto pciscan_done
param pci-dev-${addr:busdevfn} ${pci/${addr}.0.2}:${pci/${addr}.2.2}
goto pciscan
:pciscan_done
chain http://server.domain.lan/inventory.php##params
@robinsmidsrod
robinsmidsrod / pcap_remote.cmd
Last active February 14, 2021 08:50
Capture packets via remote tcpdump using SSH and display in local Wireshark client (Windows batch file)
@echo off
rem Figure out path to plink.exe
set putty_dir_key="HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\PuTTY_is1"
for /f "tokens=3*" %%x in ('reg query %putty_dir_key% /v "InstallLocation"') do set putty_dir=%%x %%y
if not defined putty_dir (
echo Please install PuTTY using Windows installer from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
exit /b 1
)
set plink="%putty_dir%\plink.exe"
@robinsmidsrod
robinsmidsrod / dhcpd.conf
Last active August 26, 2023 12:24
Booting an Apple Mac into iPXE using simulated Apple Boot Server on ISC DHCPD
next-server 10.0.3.2;
if ( substring(option vendor-class-identifier, 0, 9) = "AAPLBSDPC"
and substring(option vendor-class-identifier, 10, 4) = "i386" ) {
# This needs to be there to tell the client we're an Apple boot server
option vendor-class-identifier "AAPLBSDPC";
# Normally the client asks for a list, we respond, they tell us what we want,
# then we send a select back with the information of that image.
# This skips all that and forces the select down to the client.
option vendor-encapsulated-options 01:01:02;
# Use ipxe.efi for native drivers, or snponly.efi for underlying UNDI
@robinsmidsrod
robinsmidsrod / README.md
Last active March 13, 2020 11:53
iPXE recipe for booting XenServer without using mboot.c32 or pxelinux.0
  1. Mount the XenServer ISO.

  2. Create a directory in which to place some of the files. Change into that directory.

  3. Assuming the ISO is mounted in /media/cdrom, then do:

    # zcat /media/cdrom/boot/xen.gz > xen
    # zcat /media/cdrom/boot/vmlinuz > vmlinuz
    # cp /media/cdrom/install.img install.img
    
@robinsmidsrod
robinsmidsrod / gist:788eb37babc0fff5b18f
Last active March 23, 2017 08:12
Games menu for my iPXE menu example
############################ GAMES MENU #########################
:menu-games
menu Games for ${initiator-iqn}
item invaders Invaders (Space Invaders clone)
item tint Tint (Tetris clone)
item mineassemble MineAssemble (Minecraft clone, not working)
item
item --key 0x08 back Back to top menu...
iseq ${menu-default} menu-games && isset ${submenu-default} && goto menu-games-timed ||
@robinsmidsrod
robinsmidsrod / enchanting.txt
Last active August 29, 2015 14:01
Elder Scrolls Online enchanting construction and deconstruction skill increase notes
Glyph deconstruction
=================================================
3880 blue glyph from player 35-45 (average)
3104 green glyph from player 35-45 (average) x4
2817 blue glyph from player 25-35 (lesser)
2636 green glyph from player 30-40 (moderate) x2
2254 green glyph from player 25-35 (lesser) x7
1857 green glyph from player 20-30 (minor) x2
1536 green glyph from player 15-25 (slight)
991 white glyph from wild 45-50 (great) x8
@robinsmidsrod
robinsmidsrod / gist:9326960
Last active August 29, 2015 13:56
Problematic URI parsing in iPXE, redirect2 ends up as a query param to url3, it should stay with url2
#!ipxe
set url1 http://boot.smidsrod.lan/path1?key1=value1#frag1
set url2 http://boot.smidsrod.lan/path2?key2=value2&redirect2=${url1:uristring}#frag2
set url3 http://boot.smidsrod.lan/path3?key3=value3&redirect3=${url2:uristring}#frag3
chain ${url3} ||
shell
Result: http://boot.smidsrod.lan/path3?key3=value3&redirect3=http%3A//boot.smidsrod.lan/path2%3Fkey2=value2&redirect2=http%3A//boot.smidsrod.lan/path1%3Fkey1=value1#frag1%23frag2%23frag3
Expected url2: http://boot.smidsrod.lan/path2?key2=value2&redirect2=http%3A%2F%2Fboot.smidsrod.lan%2Fpath1%3Fkey1%3Dvalue1%23frag1#frag2
@jdeblese
jdeblese / tccs.pl
Last active December 31, 2017 10:27
Modified version of tccs (http://tccs.sourceforge.net/) to add support for hfsc classes
#!/usr/bin/perl -w
# copyright 2005-2008 Tomasz Pala <gotar@pld-linux.org>
# Contributions by Jan-willem De Bleser, 2013
# license: GPL
# usage:
# watch -d -n1 'tc -s c ls dev imq1 | tccs -f 10 2>/dev/null'
# tccs.rc file format: